1: /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
   2: /* $Header: B1num.h,v 1.1 84/06/28 00:48:38 timo Exp $ */
   3: 
   4: /* Definitions for number internals */
   5: 
   6: typedef struct{double p, q;} number;
   7: typedef double integer;
   8: #define Zero ((integer) 0)
   9: #define One ((integer) 1)
  10: #define Two ((integer) 2)
  11: 
  12: #define Checknum(v) if ((v)->type != Num) error("value not a number")
  13: #define Numerator(v) ((integer) ((number *)Ats(v))->p)
  14: #define Denominator(v) ((integer) ((number *)Ats(v))->q)
  15: #define Exact(v) (((number *)Ats(v))->q != Zero)
  16: #define Integral(v) (Exact(v) && (Denominator(v)==One))
  17: #define Approxval(v) (((number *)Ats(v))->p)
  18: #define Numval(v) (Exact(v) ? Numerator(v)/Denominator(v) : Approxval(v))
  19: 
  20: value mk_int();
  21: value mk_approx();
  22: value mk_exact();

Defined typedef's

integer defined in line 7; used 21 times

Defined macros

Checknum defined in line 12; used 18 times
Denominator defined in line 14; used 36 times
Exact defined in line 15; used 21 times
Numerator defined in line 13; used 33 times
Numval defined in line 18; used 17 times
One defined in line 9; used 25 times
Two defined in line 10; used 4 times
Zero defined in line 8; used 15 times

Usage of this include

Last modified: 1985-08-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 768
Valid CSS Valid XHTML 1.0 Strict