File: Field.hh

package info (click to toggle)
topcom 0.17.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 78,572 kB
  • sloc: cpp: 16,640; sh: 975; makefile: 345; ansic: 40
file content (34 lines) | stat: -rw-r--r-- 622 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
////////////////////////////////////////////////////////////////////////////////
// 
// Field.hh 
//
//    produced: 21/08/97 jr
// last change: 30/10/97 jr
//
////////////////////////////////////////////////////////////////////////////////
#ifndef FIELD_HH
#define FIELD_HH

#include <Rational.h>

typedef Rational Field;

static const Field ZERO     = Field(0);
static const Field ONE      = Field(1);
static const Field MINUSONE = Field(-1);

inline const int sign(const Field& f) { 
  if (f == ZERO) { 
    return 0; 
  }
  else if (f > ZERO) {
    return 1;
  }
  else {
    return -1;
  }
}

#endif

// eof Field.hh