home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / lang / lsc30p4u.sit / math.h < prev    next >
Text File  |  1989-01-16  |  3KB  |  139 lines

  1. /****************************************************************************
  2.  
  3.     Standard math library header for LightspeedC.
  4.  
  5.     (C) Copyright 1986 THINK Technologies, Inc.  All rights reserved.
  6.  
  7. *****************************************************************************/
  8.  
  9. #ifndef    _math_
  10. #define    _math_
  11.  
  12. #undef _MC68881_
  13. #if sizeof(double) == 12
  14. #define _MC68881_
  15. #endif
  16.  
  17. #undef _ERRORCHECK_
  18. #ifndef _NOERRORCHECK_
  19. #define _ERRORCHECK_
  20. #endif
  21.  
  22. #define    PI        (3.14159265358979323846)
  23. #define    PI2        (1.57079632679489661923)
  24. #define    PI4        (0.78539816339744830966)
  25. #define    E        (2.71828182845904523536)
  26.  
  27. typedef enum { EDOM=33, ERANGE=34 };
  28.  
  29. #ifdef _ERRORCHECK_
  30. extern int errno;    /* defined in stdio */
  31. #endif
  32.  
  33. #ifdef _MC68881_
  34.  
  35.     #ifdef _ERRORCHECK_
  36.     
  37.     /*  non-error-checking versions  */
  38.  
  39.     double    _acos(double x);
  40.     double    _asin(double x);
  41.     double    _atan(double x);
  42.     double    _atan2(double y, double x);
  43.     double    _ceil(double x);
  44.     double    _cos(double x);
  45.     double    _cosh(double x);
  46.     double    _exp(double x);
  47.     double    _fabs(double x);
  48.     double    _floor(double x);
  49.     double    _fmod(double x, double y);
  50.     double    _frexp(double x, int *i);
  51.     double    _ldexp(double x, int n);
  52.     double    _log(double x);
  53.     double    _log10(double x);
  54.     double    _modf(double x, double *ip);
  55.     double    _pow(double x, double y);
  56.     double    _sin(double x);
  57.     double    _sinh(double x);
  58.     double    _sqrt(double x);
  59.     double    _tan(double x);
  60.     double    _tanh(double x);
  61.  
  62.     #else
  63.  
  64.     #define acos(x)        _acos(x)
  65.     #define asin(x)        _asin(x)
  66.     #define atan(x)     _atan(x)
  67.     #define atan2(y, x) _atan2(y, x)
  68.     #define ceil(x)     _ceil(x)
  69.     #define cos(x)        _cos(x)
  70.     #define cosh(x)        _cosh(x)
  71.     #define exp(x)        _exp(x)
  72.     #define fabs(x)        _fabs(x)
  73.     #define floor(x)    _floor(x)
  74.     #define fmod(x, y)    _fmod(x, y)
  75.     #define frexp(x, i) _frexp(x, i)
  76.     #define ldexp(x, n) _ldexp(x, n)
  77.     #define log(x)        _log(x)
  78.     #define log10(x)    _log10(x)
  79.     #define modf(x, ip) _modf(x, ip)
  80.     #define pow(x, y)    _pow(x, y)
  81.     #define sin(x)        _sin(x)
  82.     #define sinh(x)        _sinh(x)
  83.     #define sqrt(x)        _sqrt(x)
  84.     #define tan(x)        _tan(x)
  85.     #define tanh(x)        _tanh(x)
  86.  
  87.     #endif /* _ERRORCHECK_ */
  88.  
  89. typedef struct {
  90.     long long1;
  91.     long long2;
  92. } TwoLongs;        /* the mantissa of a double, be it 80 or 96 bits */
  93.  
  94. /* 80-bit extended */
  95. typedef struct {
  96.     int            exponent;            /* word also contains sign bit */
  97.     TwoLongs    mantissa;
  98. } Extended80;
  99.  
  100. /* 96-bit extended */
  101. typedef struct {
  102.     int            exponent;            /* word also contains sign bit */
  103.     int            reserved;            /* extra 16 bits of zero reserved for 68881 */
  104.     TwoLongs    mantissa;
  105. } Extended96;
  106.  
  107. #endif /* _MC68881_ */
  108.  
  109.  
  110. /*  functions  */
  111.  
  112. int        abs(int i);
  113. long    labs(long l);
  114.  
  115. double    acos(double x);
  116. double    asin(double x);
  117. double    atan(double x);
  118. double    atan2(double y, double x);
  119. double    ceil(double x);
  120. double    cos(double x);
  121. double    cosh(double x);
  122. double    exp(double x);
  123. double    fabs(double x);
  124. double    floor(double x);
  125. double    fmod(double x, double y);
  126. double    frexp(double x, int *i);
  127. double    ldexp(double x, int n);
  128. double    log(double x);
  129. double    log10(double x);
  130. double    modf(double x, double *i);
  131. double    pow(double x, double y);
  132. double    sin(double x);
  133. double    sinh(double x);
  134. double    sqrt(double x);
  135. double    tan(double x);
  136. double    tanh(double x);
  137.  
  138. #endif /* _math_ */
  139.