home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0000 - 0009 / ibm0000-0009 / ibm0003.tar / ibm0003 / C_DISK2.ZIP / MATH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  1.9 KB  |  68 lines

  1. /*_ math.h   Thu Apr 16 1987   Modified by: Walter Bright */
  2. /* Copyright (C) 1985-1987 by Northwest Software    */
  3. /* All Rights Reserved                    */
  4.  
  5. #ifndef MATH_H
  6. #define MATH_H    1
  7.  
  8. /* Header file to be used when using transcendental functions.    */
  9.  
  10. /***************************
  11.  * Struct used with matherr() when a floating point exception occurs.
  12.  *    type    DOMAIN,SING,...
  13.  *    name    pointer to string defining the name of the function
  14.  *        that detected the error
  15.  *    arg1    first argument to function
  16.  *    arg2    second argument (if defined) to function
  17.  *    retval    default return value
  18.  */
  19.  
  20. struct exception
  21.     {    int type;
  22.         char *name;
  23.         double arg1,arg2,retval;
  24.     };
  25.  
  26. /***********************
  27.  * Values for exception.type:
  28.  *    DOMAIN        arguments are out of range for the function
  29.  *    SING        argument is a singularity
  30.  *    OVERFLOW
  31.  *    UNDERFLOW
  32.  *    TLOSS        total loss of significant digits
  33.  *    PLOSS        partial loss of significant digits
  34.  */
  35.  
  36. #define DOMAIN        1
  37. #define SING        2
  38. #define    OVERFLOW    3
  39. #define UNDERFLOW    4
  40. #define TLOSS        5
  41. #define PLOSS        6
  42.  
  43. /*************************
  44.  * Largest double number.
  45.  */
  46.  
  47. #define HUGE_VAL    1.797693134862315e+308
  48. /*#define HUGE_VAL    MAXDOUBLE    */
  49.  
  50. /* Constants that the 8087 supports directly    */
  51. #define PI        3.14159265358979323846
  52. #define LOG2        0.30102999566398119521
  53. #define LN2        0.6931471805599453094172321
  54. #define LOG2T        3.32192809488736234787
  55. #define LOG2E        1.4426950408889634074    /* 1/LN2        */
  56.  
  57. extern double    atof(char *),sin(double),cos(double),
  58.         tan(double),asin(double),acos(double),atan(double),
  59.         atan2(double,double),
  60.         sinh(double),cosh(double),tanh(double),
  61.         frexp(double,int *),ldexp(double,int),
  62.         exp(double),log(double),pow(double,double),
  63.         sqrt(double),hypot(double,double),log10(double),
  64.         modf(double,double *),fabs(double),ceil(double),floor(double),
  65.         fmod(double,double),poly(double,int,double []);
  66.  
  67. #endif /* MATH_H */
  68.