home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / math.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  5.4 KB  |  178 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10.  
  11. #ident    "@(#)//usr/ucbinclude/math.h.sl 1.1 4.0 12/08/90 28417 AT&T-USL"
  12.  
  13. /*******************************************************************
  14.  
  15.         PROPRIETARY NOTICE (Combined)
  16.  
  17. This source code is unpublished proprietary information
  18. constituting, or derived under license from AT&T's UNIX(r) System V.
  19. In addition, portions of such source code were derived from Berkeley
  20. 4.3 BSD under license from the Regents of the University of
  21. California.
  22.  
  23.  
  24.  
  25.         Copyright Notice 
  26.  
  27. Notice of copyright on this source code product does not indicate 
  28. publication.
  29.  
  30.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  31.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  32.               All rights reserved.
  33. ********************************************************************/ 
  34.  
  35. /*
  36.  * Math library definitions for all the public functions implemented in libm.a.
  37.  */
  38.  
  39. #ifndef _math_h
  40. #define _math_h
  41.  
  42. #include <fp.h>                /* Contains definitions for types and 
  43.                      * functions implemented in libc.a.
  44.                      */
  45.  
  46. /*     4.3 BSD functions: math.h    4.6    9/11/85    */
  47.  
  48. extern int    finite();
  49. extern double fabs(), floor(), ceil(), rint();
  50. extern double hypot();
  51. extern double copysign();
  52. extern double sqrt();
  53. extern double modf(), frexp();
  54. extern double asinh(), acosh(), atanh();
  55. extern double erf(), erfc();
  56. extern double exp(), expm1(), log(), log10(), log1p(), pow();
  57. extern double lgamma();
  58. extern double j0(), j1(), jn(), y0(), y1(), yn();
  59. extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();
  60. extern double sinh(), cosh(), tanh();
  61. extern double cbrt();
  62.  
  63. /*      Sun definitions.        */
  64.  
  65. /* Implemented precisions for trigonometric argument reduction. */
  66. enum fp_pi_type {
  67.     fp_pi_infinite    = 0,    /* Infinite-precision approximation to pi. */
  68.     fp_pi_66    = 1,    /* 66-bit approximation to pi. */
  69.     fp_pi_53    = 2    /* 53-bit approximation to pi. */
  70. };
  71.  
  72. /* Pi precision to use for trigonometric argument reduction. */
  73. extern enum fp_pi_type fp_pi;
  74.  
  75. /*    Functions callable from C, intended to support IEEE arithmetic.    */
  76.  
  77. extern enum fp_class_type fp_class();
  78. extern int ilogb(), irint(), signbit();
  79. extern int isinf(), isnan(), isnormal(), issubnormal(), iszero();
  80. extern void ieee_retrospective(), standard_arithmetic(), nonstandard_arithmetic();
  81. extern double nextafter(), remainder();
  82. extern double logb(), significand(), scalb(), scalbn();
  83. extern double min_subnormal(), max_subnormal();
  84. extern double min_normal(), max_normal();
  85. extern double infinity(), quiet_nan(), signaling_nan();
  86. extern int ieee_flags ();
  87. extern int ieee_handler ();
  88.  
  89. /*    Other functions for C programmers.    */
  90.  
  91. extern double log2(), exp10(), exp2(), aint(), anint();
  92. extern int nint();
  93. extern void sincos(), sincospi();
  94. extern double sinpi(), cospi(), tanpi(), asinpi(), acospi(), atanpi(), atan2pi();
  95. extern double compound(), annuity();
  96.  
  97. /*     Constants, variables, and functions from System V */
  98.  
  99. #define _ABS(x) ((x) < 0 ? -(x) : (x))
  100.  
  101. #ifndef HUGE
  102. #if #machine(gcos)
  103. #define HUGE        ((float)1.7014118219281863150e+38)
  104. #else
  105. #if #machine(pdp11) || #machine(vax)
  106. #define HUGE        ((float)1.701411733192644299e+38) /* From BSD4.3 */
  107. #else
  108. #define HUGE        ((float)3.40282346638528860e+38)
  109. #endif
  110. #endif
  111. #endif
  112.  
  113. #define DOMAIN          1
  114. #define SING            2
  115. #define OVERFLOW        3
  116. #define UNDERFLOW       4
  117. #define TLOSS           5
  118. #define PLOSS           6
  119.  
  120. struct exception {
  121.         int type;
  122.         char *name;
  123.         double arg1;
  124.         double arg2;
  125.         double retval;
  126. };
  127.  
  128. extern int signgam;
  129.  
  130. extern double fmod(), ldexp();
  131. extern int matherr();
  132.  
  133. /* First three have to be defined exactly as in values.h including spacing! */
  134.  
  135. #define M_LN2    0.69314718055994530942
  136. #define M_PI    3.14159265358979323846
  137. #define M_SQRT2    1.41421356237309504880
  138.  
  139. #define M_E        2.7182818284590452354
  140. #define M_LOG2E        1.4426950408889634074
  141. #define M_LOG10E    0.43429448190325182765
  142. #define M_LN10        2.30258509299404568402
  143. #define M_PI_2        1.57079632679489661923
  144. #define M_PI_4        0.78539816339744830962
  145. #define M_1_PI        0.31830988618379067154
  146. #define M_2_PI        0.63661977236758134308
  147. #define M_2_SQRTPI    1.12837916709551257390
  148. #define M_SQRT1_2    0.70710678118654752440
  149. #define _POLY1(x, c)    ((c)[0] * (x) + (c)[1])
  150. #define _POLY2(x, c)    (_POLY1((x), (c)) * (x) + (c)[2])
  151. #define _POLY3(x, c)    (_POLY2((x), (c)) * (x) + (c)[3])
  152. #define _POLY4(x, c)    (_POLY3((x), (c)) * (x) + (c)[4])
  153. #define _POLY5(x, c)    (_POLY4((x), (c)) * (x) + (c)[5])
  154. #define _POLY6(x, c)    (_POLY5((x), (c)) * (x) + (c)[6])
  155. #define _POLY7(x, c)    (_POLY6((x), (c)) * (x) + (c)[7])
  156. #define _POLY8(x, c)    (_POLY7((x), (c)) * (x) + (c)[8])
  157. #define _POLY9(x, c)    (_POLY8((x), (c)) * (x) + (c)[9])
  158.  
  159. /*     
  160.  *    Deprecated functions for compatibility with past.  
  161.  *    Changes planned for future.
  162.  */
  163.  
  164. extern double cabs();    /* Use double hypot(x,y)
  165.              * Traditional cabs usage is confused - 
  166.              * is its argument two doubles or one struct?
  167.              */
  168. extern double drem();    /* Use double remainder(x,y)
  169.              * drem will disappear in a future release.
  170.              */
  171. extern double gamma();    /* Use double lgamma(x)
  172.              * to compute log of gamma function.
  173.              * Name gamma is reserved for true gamma function
  174.              * to appear in a future release.
  175.              */
  176.  
  177. #endif /*!_math_h*/
  178.