home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / incla / math.h__ / MATH.H
Encoding:
C/C++ Source or Header  |  1992-09-30  |  6.0 KB  |  181 lines

  1. #ifndef __math_h
  2.    #define __math_h
  3.  
  4.    #pragma info( none )
  5.    #ifndef __CHKHDR__
  6.       #pragma info( none )
  7.    #endif
  8.    #pragma info( restore )
  9.  
  10.    #ifdef __cplusplus
  11.       extern "C" {
  12.    #endif
  13.  
  14.    /********************************************************************/
  15.    /*  <math.h> header file                                            */
  16.    /*                                                                  */
  17.    /*  Licensed Materials - Property of IBM                            */
  18.    /*                                                                  */
  19.    /*  IBM C Set/2 Beta Version                                        */
  20.    /*  Copyright (C) International Business Machines Corp., 1991,1992  */
  21.    /*  All rights reserved                                             */
  22.    /*                                                                  */
  23.    /*  US Government Users Restricted Rights -                         */
  24.    /*  Use, duplication, or disclosure restricted                      */
  25.    /*  by GSA ADP Schedule Contract with IBM Corp.                     */
  26.    /*                                                                  */
  27.    /********************************************************************/
  28.  
  29.    extern const double _infinity;
  30.    #define HUGE_VAL    _infinity
  31.  
  32.    /* function prototypes */
  33.  
  34.    double _Builtin __fabs( double );
  35.    double _Optlink acos( double );
  36.    double _Optlink asin( double );
  37.    double _Optlink atan( double );
  38.    double _Optlink atan2( double, double );
  39.    double _Optlink ceil( double );
  40.    double _Optlink cos( double );
  41.    double _Optlink cosh( double );
  42.    double _Optlink exp( double );
  43.    double _Optlink fabs( double );
  44.    double _Optlink floor( double );
  45.    double _Optlink fmod( double, double );
  46.    double _Optlink frexp( double, int * );
  47.    double _Optlink ldexp( double, int );
  48.    double _Optlink log( double );
  49.    double _Optlink log10( double );
  50.    double _Optlink modf( double, double * );
  51.    double _Optlink pow( double, double );
  52.    double _Optlink sin( double );
  53.    double _Optlink sinh( double );
  54.    double _Optlink sqrt( double );
  55.    double _Optlink tan( double );
  56.    double _Optlink tanh( double );
  57.  
  58.  
  59. #if (defined( _FP_INLINE ))
  60.  
  61.    double _Builtin __fsin ( double );
  62.    double _Builtin __fcos ( double );
  63.    double _Builtin __fptan ( double );
  64.    double _Builtin __fpatan ( double );
  65.    double _Builtin __facos ( double );
  66.    double _Builtin __fasin ( double );
  67.  
  68.  
  69.    #define sin( x )       __fsin( (x) )
  70.    #define cos( x )       __fcos( (x) )
  71.    #define tan( x )       __fptan( (x) )
  72.    #define atan( x )      __fpatan( (x) )
  73.    #define acos( x )      __facos( (x) )
  74.    #define asin( x )      __fasin( (x) )
  75.  
  76. #endif
  77.  
  78.  
  79. #ifndef __cplusplus
  80.    #pragma info( none )
  81.    #define fabs( x ) __fabs( (x) )
  82.    #pragma info( restore )
  83. #endif
  84.  
  85.    #ifndef __ANSI__
  86.  
  87.       #pragma map( erf, "_erf" )
  88.       #pragma map( erfc, "_erfc" )
  89.       #pragma map( gamma, "_gamma" )
  90.       #pragma map( hypot, "_hypot" )
  91.       #pragma map( j0, "_j0" )
  92.       #pragma map( j1, "_j1" )
  93.       #pragma map( jn, "_jn" )
  94.       #pragma map( y0, "_y0" )
  95.       #pragma map( y1, "_y1" )
  96.       #pragma map( yn, "_yn" )
  97.  
  98.       double _Optlink _erf( double );
  99.       double _Optlink _erfc( double );
  100.       double _Optlink _gamma( double );
  101.       double _Optlink _hypot( double, double );
  102.       double _Optlink _j0( double );
  103.       double _Optlink _j1( double );
  104.       double _Optlink _jn( int, double );
  105.       double _Optlink _y0( double );
  106.       double _Optlink _y1( double );
  107.       double _Optlink _yn( int, double );
  108.       double _Optlink erf( double );
  109.       double _Optlink erfc( double );
  110.       double _Optlink gamma( double );
  111.       double _Optlink hypot( double, double );
  112.       double _Optlink j0( double );
  113.       double _Optlink j1( double );
  114.       double _Optlink jn( int, double );
  115.       double _Optlink y0( double );
  116.       double _Optlink y1( double );
  117.       double _Optlink yn( int, double );
  118.  
  119.       #ifndef __SAA_L2__
  120.          extern const long double _LHUGE_VAL;
  121.          #define _LHUGE _LHUGE_VAL
  122.       #endif
  123.  
  124.       #if  defined(__EXTENDED__)
  125.  
  126.          #define HUGE   HUGE_VAL
  127.  
  128.          #define DOMAIN           1       /* argument domain error */
  129.          #define SING             2       /* argument singularity */
  130.          #define OVERFLOW         3       /* overflow range error */
  131.          #define UNDERFLOW        4       /* underflow range error */
  132.          #define TLOSS            5       /* total loss of precision */
  133.          #define PLOSS            6       /* partial loss of precision */
  134.          #define UNKNOWN          7       /* unknown error probably caused by */
  135.                                           /* changing the 80387 control word */
  136.  
  137.          struct exception
  138.             {
  139.             int type;               /* exception type - see below */
  140.             char *name;             /* name of function where error occured */
  141.             double arg1;            /* first argument to function */
  142.             double arg2;            /* second argument (if any) to function */
  143.             double retval;          /* value to be returned by function */
  144.             };
  145.  
  146.          #if (!defined(__cplusplus) || defined(__C_complex))
  147.             struct complex
  148.                {
  149.                double x,y;             /* real and imaginary parts */
  150.                };
  151.  
  152.             double      _Optlink cabs( struct complex );
  153.          #endif
  154.  
  155.          /* _matherr is defined by the user */
  156.  
  157.          int         _matherr( struct exception * );
  158.          long double _Optlink _atold( const char * );
  159.  
  160.          #pragma info( none )
  161.          #define _cabs( z ) _hypot( z.x, z.y )
  162.          #define cabs( a ) _cab( (a) )
  163.          #pragma info( restore )
  164.  
  165.          #define matherr _matherr
  166.       #endif
  167.  
  168.    #endif
  169.  
  170.    #ifdef __cplusplus
  171.       }
  172.    #endif
  173.  
  174.    #pragma info( none )
  175.    #ifndef __CHKHDR__
  176.       #pragma info( restore )
  177.    #endif
  178.    #pragma info( restore )
  179.  
  180. #endif
  181.