| 1 | /* +++Date last modified: 05-Jul-1997 */ |
|---|
| 2 | |
|---|
| 3 | /* |
|---|
| 4 | ** SNIPMATH.H - Header file for SNIPPETS math functions and macros |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | #ifndef SNIPMATH__H |
|---|
| 8 | #define SNIPMATH__H |
|---|
| 9 | |
|---|
| 10 | #include <math.h> |
|---|
| 11 | #include "basicmath-sniptype.h" |
|---|
| 12 | #include "basicmath-round.h" |
|---|
| 13 | |
|---|
| 14 | /* |
|---|
| 15 | ** Callable library functions begin here |
|---|
| 16 | */ |
|---|
| 17 | |
|---|
| 18 | void SetBCDLen(int n); /* Bcdl.C */ |
|---|
| 19 | long BCDtoLong(char *BCDNum); /* Bcdl.C */ |
|---|
| 20 | void LongtoBCD(long num, char BCDNum[]); /* Bcdl.C */ |
|---|
| 21 | double bcd_to_double(void *buf, size_t len, /* Bcdd.C */ |
|---|
| 22 | int digits); |
|---|
| 23 | int double_to_bcd(double arg, char *buf, /* Bcdd.C */ |
|---|
| 24 | size_t length, size_t digits ); |
|---|
| 25 | DWORD ncomb1 (int n, int m); /* Combin.C */ |
|---|
| 26 | DWORD ncomb2 (int n, int m); /* Combin.C */ |
|---|
| 27 | void SolveCubic(double a, double b, double c, /* Cubic.C */ |
|---|
| 28 | double d, int *solutions, |
|---|
| 29 | double *x); |
|---|
| 30 | DWORD dbl2ulong(double t); /* Dbl2Long.C */ |
|---|
| 31 | long dbl2long(double t); /* Dbl2Long.C */ |
|---|
| 32 | double dround(double x); /* Dblround.C */ |
|---|
| 33 | |
|---|
| 34 | /* Use #defines for Permutations and Combinations -- Factoryl.C */ |
|---|
| 35 | |
|---|
| 36 | #define log10P(n,r) (log10factorial(n)-log10factorial((n)-(r))) |
|---|
| 37 | #define log10C(n,r) (log10P((n),(r))-log10factorial(r)) |
|---|
| 38 | |
|---|
| 39 | double log10factorial(double N); /* Factoryl.C */ |
|---|
| 40 | |
|---|
| 41 | double fibo(unsigned short term); /* Fibo.C */ |
|---|
| 42 | double frandom(int n); /* Frand.C */ |
|---|
| 43 | double ipow(double x, int n); /* Ipow.C */ |
|---|
| 44 | int ispow2(int x); /* Ispow2.C */ |
|---|
| 45 | long double ldfloor(long double a); /* Ldfloor.C */ |
|---|
| 46 | int initlogscale(long dmax, long rmax); /* Logscale.C */ |
|---|
| 47 | long logscale(long d); /* Logscale.C */ |
|---|
| 48 | |
|---|
| 49 | float MSBINToIEEE(float f); /* Msb2Ieee.C */ |
|---|
| 50 | float IEEEToMSBIN(float f); /* Msb2Ieee.C */ |
|---|
| 51 | int perm_index (char pit[], int size); /* Perm_Idx.C */ |
|---|
| 52 | int round_div(int n, int d); /* Rnd_Div.C */ |
|---|
| 53 | long round_ldiv(long n, long d); /* Rnd_Div.C */ |
|---|
| 54 | double rad2deg(double rad); /* Rad2Deg.C */ |
|---|
| 55 | double deg2rad(double deg); /* Rad2Deg.C */ |
|---|
| 56 | |
|---|
| 57 | #include "basicmath-pi.h" |
|---|
| 58 | #ifndef PHI |
|---|
| 59 | #define PHI ((1.0+sqrt(5.0))/2.0) /* the golden number */ |
|---|
| 60 | #define INV_PHI (1.0/PHI) /* the golden ratio */ |
|---|
| 61 | #endif |
|---|
| 62 | |
|---|
| 63 | /* |
|---|
| 64 | ** File: ISQRT.C |
|---|
| 65 | */ |
|---|
| 66 | |
|---|
| 67 | struct int_sqrt { |
|---|
| 68 | unsigned sqrt, |
|---|
| 69 | frac; |
|---|
| 70 | }; |
|---|
| 71 | |
|---|
| 72 | void usqrt(unsigned long x, struct int_sqrt *q); |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | #endif /* SNIPMATH__H */ |
|---|