[26] | 1 | /*************************************************************************/ |
---|
| 2 | /* */ |
---|
| 3 | /* Definitions used in C4.5 */ |
---|
| 4 | /* ------------------------ */ |
---|
| 5 | /* */ |
---|
| 6 | /*************************************************************************/ |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | #include <stdio.h> |
---|
| 10 | #include <math.h> |
---|
| 11 | |
---|
| 12 | #define Eof EOF /*char read on end of file*/ |
---|
| 13 | #define Nil 0 /*null pointer*/ |
---|
| 14 | #define false 0 |
---|
| 15 | #define true 1 |
---|
| 16 | #define None -1 |
---|
| 17 | #define Epsilon 1E-3 |
---|
| 18 | |
---|
| 19 | long random(); |
---|
| 20 | #define Random ((random()&2147483647) / 2147483648.0) |
---|
| 21 | |
---|
| 22 | #define Max(a,b) ((a)>(b) ? a : b) |
---|
| 23 | #define Min(a,b) ((a)<(b) ? a : b) |
---|
| 24 | #define Round(x) ((int) (x+0.5)) |
---|
| 25 | #define Log2 0.69314718055994530942 |
---|
| 26 | #define Log(x) ((x) <= 0 ? 0.0 : log((float)x) / Log2) |
---|
| 27 | |
---|
| 28 | #define Bit(b) (1 << (b)) |
---|
| 29 | #define In(b,s) ((s[(b) >> 3]) & Bit((b) & 07)) |
---|
| 30 | #define ClearBits(n,s) memset(s,0,n) |
---|
| 31 | #define CopyBits(n,f,t) memcpy(t,f,n) |
---|
| 32 | #define SetBit(b,s) (s[(b) >> 3] |= Bit((b) & 07)) |
---|
| 33 | |
---|
| 34 | #define ForEach(v,f,l) for(v=f ; v<=l ; ++v) |
---|
| 35 | |
---|
| 36 | #define Verbosity(d) if(VERBOSITY >= d) |
---|
| 37 | |
---|
| 38 | #define Check(v,l,h)\ |
---|
| 39 | if ( v<l||v>h ) {printf("\t** illegal value **\n"); exit(1);} |
---|