snipmath.h 3.0 KB

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