home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / MATH.H < prev    next >
C/C++ Source or Header  |  1996-07-24  |  4KB  |  119 lines

  1. /*
  2.  *  math.h    Math functions
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _MATH_H_INCLUDED
  7. #define _MATH_H_INCLUDED
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. #ifndef _COMDEF_H_INCLUDED
  13.  #include <_comdef.h>
  14. #endif
  15.  
  16. #if defined(_M_IX86)
  17.   #pragma pack(__push,1);
  18. #else
  19.   #pragma pack(__push,8);
  20. #endif
  21.  
  22. #if defined(__SW_BR) || defined(_RTDLL) 
  23.  #define _HugeValue _HugeValue_br
  24. #endif
  25. #ifdef M_I86HM
  26.  _WCRTLINK extern const double _WCFAR  _HugeValue;
  27. #else
  28.  _WCRTLINK extern const double _WCNEAR _HugeValue;
  29. #endif
  30. #define HUGE_VAL _HugeValue
  31.  
  32. _WMRTLINK extern double ceil( double __x );
  33. _WMRTLINK extern double floor( double __x );
  34. _WMRTLINK extern double frexp( double __value, int *__exp );
  35. _WMRTLINK extern double ldexp( double __x, int __exp );
  36. _WMRTLINK extern double modf( double __value, double *__iptr );
  37. _WMIRTLINK extern double acos( double __x );
  38. _WMIRTLINK extern double asin( double __x );
  39. _WMIRTLINK extern double atan( double __x );
  40. _WMIRTLINK extern double atan2( double __y, double __x );
  41. _WMIRTLINK extern double cos( double __x );
  42. _WMIRTLINK extern double cosh( double __x );
  43. _WMIRTLINK extern double exp( double __x );
  44. _WMIRTLINK extern double fabs( double __x );
  45. _WMIRTLINK extern double fmod( double __x, double __y );
  46. _WMIRTLINK extern double log( double __x );
  47. _WMIRTLINK extern double log10( double __x );
  48. _WMIRTLINK extern double pow( double __x, double __y );
  49. _WMIRTLINK extern double sin( double __x );
  50. _WMIRTLINK extern double sinh( double __x );
  51. _WMIRTLINK extern double sqrt( double __x );
  52. _WMIRTLINK extern double tan( double __x );
  53. _WMIRTLINK extern double tanh( double __x );
  54.  
  55. /* non-ANSI */
  56. #if !defined(NO_EXT_KEYS) /* extensions enabled */
  57.  
  58. struct _complex {
  59.     double    x;
  60.     double    y;
  61. };
  62. #ifndef __cplusplus
  63. struct complex {
  64.     double    x;
  65.     double    y;
  66. };
  67. #endif
  68.  
  69. _WMRTLINK extern double    acosh( double __x );
  70. _WMRTLINK extern double    asinh( double __x );
  71. _WMRTLINK extern double    atanh( double __x );
  72. _WMRTLINK extern double    cabs( struct _complex );
  73. _WMRTLINK extern double    hypot( double __x, double __y );
  74. _WMRTLINK extern double    j0( double __x );
  75. _WMRTLINK extern double    j1( double __x );
  76. _WMRTLINK extern double    jn( int __n, double __x );
  77. _WMRTLINK extern double    log2( double __x );
  78. _WMRTLINK extern double    y0( double __x );
  79. _WMRTLINK extern double    y1( double __x );
  80. _WMRTLINK extern double    yn( int __n, double __x );
  81.  
  82. /* The following struct is used to record errors detected in the math library.
  83.  * matherr is called with a pointer to this struct for possible error recovery.
  84.  */
  85.  
  86. struct    exception {
  87.     int    type;        /* type of error, see below */
  88.     char    *name;        /* name of math function */
  89.     double    arg1;        /* value of first argument to function */
  90.     double    arg2;        /* second argument (if indicated) */
  91.     double    retval;     /* default return value */
  92. };
  93.  
  94. #define DOMAIN        1    /* argument domain error */
  95. #define SING        2    /* argument singularity  */
  96. #define OVERFLOW    3    /* overflow range error  */
  97. #define UNDERFLOW    4    /* underflow range error */
  98. #define TLOSS        5    /* total loss of significance */
  99. #define PLOSS        6    /* partial loss of significance */
  100.  
  101. _WMRTLINK extern int    matherr( struct exception * );
  102. _WMRTLINK extern double    _matherr( struct exception * );
  103. #endif /* EXTENSIONS */
  104.  
  105.  
  106. #if !defined( __NO_MATH_OPS ) && defined(_M_IX86)
  107. /*
  108.     Defining the __NO_MATH_OPS macro will stop the compiler from recogizing
  109.     the following functions as intrinsic operators.
  110. */
  111.  #pragma intrinsic(log,cos,sin,tan,sqrt,fabs,pow,atan2,fmod)
  112.  #pragma intrinsic(acos,asin,atan,cosh,exp,log10,sinh,tanh)
  113. #endif
  114. #pragma pack(__pop);
  115. #ifdef __cplusplus
  116. };
  117. #endif
  118. #endif
  119.