home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 228_01 / mathmax.h < prev    next >
Text File  |  1987-07-31  |  2KB  |  80 lines

  1. /*
  2. HEADER:         CUGXXX;
  3. TITLE:          Mathematical subroutines;
  4. DATE:           11-1-85;
  5. DESCRIPTION:    Mathematical subroutines;
  6. KEYWORDS:       Mathematics, Math functions;  
  7. FILENAME:       MATHMAX.H;
  8. WARNINGS:       None;
  9. AUTHORS:        Max R. Dürsteler;
  10. COMPILER:       Lattice C, Microsoft C;
  11. REFERENCES:     US-DISK 1307;
  12. ENDREF
  13. */
  14. /*
  15.  *    S T A N D A R D   H E A D E R    F I L E
  16.  *
  17.  *        M A T H   P A C K A G E
  18.  */
  19.  
  20.     /* Functions */
  21.  
  22. extern double fabs(), floor(), ceil(), fmod();
  23. extern double sqrt(), exp(), exp2(), log(), log10(), pow(), pw10();
  24.  
  25. extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();
  26.  
  27. extern double gamma();
  28.  
  29. struct complex {     /* structure for complex numbers */
  30.     double rl;
  31.     double im;
  32. };
  33.     /* Usefull constants */
  34.  
  35. #define BLKSIZE 512
  36. #define MAXINT    32767
  37. #define BIG    72057594037927936.        /* Maximum precision of DOUBLE */
  38. #define HUGE    1.701411733192644270e38     /* Largest DOUBLE */
  39. #define LOGHUGE 39                /* 10^39 --> Largest power */
  40. #define LN2    0.69314718055994530941
  41. #define LN10    2.30258509299404568401
  42. #define E    2.7182818284590452353602874
  43. #define SQRT2    1.41421356237309504880
  44. #define HALFSQRT2    .70710678118654752440
  45. #define PI    3.141592653589793238462643
  46. #define QUARTPI 0.78539816339744830962
  47. #define HALFPI    1.57079632679489661923
  48. #define TWOPI    6.28318530717958647692
  49. #define RADPDEG 0.01745329251994329576
  50.  
  51.         /* macros */
  52.  
  53. #define sqr(x)    ((x) * (x))
  54. #define sgn(x)    ((x) < 0 ? -1 : 1)
  55. #define xswap(a,b) a ^= b, b ^= a, a ^= b
  56. #define swap(a,b,c) c = a, a = b, b = c
  57. #define max(x,y)    ((x) >= (y) ? (x) : (y))
  58. #define min(x,y)    ((x) <= (y) ? (x) : (y))
  59. #define abs(x)        ((x)<0? -(x):(x))    /* Integer Absolute value */
  60. #define fabs(x)     ((x)<0.? -(x):(x))    /* Floating absolute value */
  61. #define mod(x,y)    ((x)%(y))        /* Integer modulo */
  62. #define logE(x)     (log(x))        /* Natural log */
  63. #define ln(x)        (log(x))        /* Natural log */
  64. #define cos(x)        (sin(x+HALFPI))     /* Cosinus [radians] */
  65. #define tan(x)        (sin(x)/cos(x))     /* Tangens [radians] */
  66.  
  67. /* struct to define low and high bytes of a word. */
  68. struct lohi {
  69.     char lo, hi;
  70. } ;
  71.  
  72.  
  73. /* struct to define low and high words of a long int */
  74.  
  75.  
  76.  
  77. struct llohi {
  78.     int lhi, llo;
  79. } ;
  80.