home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !gcc / include / libscl / h / math < prev    next >
Encoding:
Text File  |  2004-09-05  |  8.1 KB  |  223 lines

  1. /* math.h.  Mathematics for the Standard C Library.
  2.  
  3.    For use with the GNU compilers.
  4.    (c) Copyright 1997, Nick Burrett.  */
  5.  
  6. #ifndef __MATH_H
  7. #define __MATH_H
  8.  
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. #ifndef HUGE_VAL
  14. #define HUGE_VAL __huge_val
  15. extern const double HUGE_VAL;
  16. #endif
  17.  
  18. /* GCC has various useful declarations that can be made with the
  19.    __attribute__ syntax.  Disable its use for other compilers.  */
  20. #ifndef __GNUC__
  21. #ifndef __attribute__
  22. #define __attribute__(x) /* Ignore.  */
  23. #endif
  24. #endif
  25.  
  26. /* Trigonometric functions.  */
  27.  
  28. /* Arc cosine of x.  */
  29. extern double acos (double __x) __attribute__ ((__const__));
  30. extern float acosf (float __x) __attribute__ ((__const__));
  31. extern long double acosl (long double __x) __attribute__ ((__const__));
  32.  
  33. /* Arc sine of x.  */
  34. extern double asin (double __x) __attribute__ ((__const__));
  35. extern float asinf (float __x) __attribute__ ((__const__));
  36. extern long double asinl (long double __x) __attribute__ ((__const__));
  37.  
  38. /* Arc tangent of x.  */
  39. extern double atan (double __x) __attribute__ ((__const__));
  40. extern float atanf (float __x) __attribute__ ((__const__));
  41. extern long double atanl (long double __x) __attribute__ ((__const__));
  42.  
  43. /* Arc tangent of y/x.  */
  44. extern double atan2 (double __y, double __x) __attribute__ ((__const__));
  45. extern float atan2f (float __y, float __x) __attribute__ ((__const__));
  46. extern long double atan2l (long double __y,
  47.                            long double __x) __attribute__ ((__const__));
  48.  
  49. /* Cosine of x.  */
  50. extern double cos (double __x) __attribute__ ((__const__));
  51. extern float cosf (float __x) __attribute__ ((__const__));
  52. extern long double cosl (long double __x) __attribute__ ((__const__));
  53.  
  54. /* Sine of x.  */
  55. extern double sin (double __x) __attribute__ ((__const__));
  56. extern float sinf (float __x) __attribute__ ((__const__));
  57. extern long double sinl (long double __x) __attribute__ ((__const__));
  58.  
  59. /* Tangent of x.  */
  60. extern double tan (double __x) __attribute__ ((__const__));
  61. extern float tanf (float __x) __attribute__ ((__const__));
  62. extern long double tanl (long double __x) __attribute__ ((__const__));
  63.  
  64. /* Hyperbolic functions.  */
  65.  
  66. /* Hyperbolic cosine of x.  */
  67. extern double cosh (double __x) __attribute__ ((__const__));
  68. extern float coshf (float __x) __attribute__ ((__const__));
  69. extern long double coshl (long double __x) __attribute__ ((__const__));
  70.  
  71. /* Hyperbolic sine of x.  */
  72. extern double sinh (double __x) __attribute__ ((__const__));
  73. extern float sinhf (float __x) __attribute__ ((__const__));
  74. extern long double sinhl (long double __x) __attribute__ ((__const__));
  75.  
  76. /* Hyperbolic tangent of x.  */
  77. extern double tanh (double __x) __attribute__ ((__const__));
  78. extern float tanhf (float __x) __attribute__ ((__const__));
  79. extern long double tanhl (long double __x) __attribute__ ((__const__));
  80.  
  81. /* Hyperbolic arc cosine of x.  */
  82. extern double acosh (double __x) __attribute__ ((__const__));
  83.  
  84. /* Hyperbolic arc sine of x.  */
  85. extern double asinh (double __x) __attribute__ ((__const__));
  86.  
  87. /* Hyperbolic arc tangent of x.  */
  88. extern double atanh (double __x) __attribute__ ((__const__));
  89.  
  90. /* Exponential and logarithmic functions.  */
  91.  
  92. /* Exponentional function of x (2 ^ e).  */
  93. extern double exp (double __x) __attribute__ ((__const__));
  94. extern float expf (float __x) __attribute__ ((__const__));
  95. extern long double expl (long double __x) __attribute__ ((__const__));
  96.  
  97. /* Exponentional function of x (2 ^ x).  */
  98. extern double exp2 (double __x) __attribute__ ((__const__));
  99.  
  100. /* Exponentional function of x (10 ^ x).  */
  101. extern double exp10 (double __x) __attribute__ ((__const__));
  102.  
  103. /* Break value into a normalized fracton and an integral power of 2.  */
  104. extern double frexp (double value, int *__exp);
  105. extern float frexpf (float value, int *__exp);
  106. extern long double frexpl (long double value, int *__exp);
  107.  
  108. /* x times (two to the exp power).  */
  109. extern double ldexp (double __x, int __exp) __attribute__ ((__const__));
  110. extern float ldexpf (float __x, int __exp) __attribute__ ((__const__));
  111. extern long double ldexpl (long __x, int __exp) __attribute__ ((__const__));
  112.  
  113. /* scalb is the BSD name for ldexp.  */
  114. extern double scalb (double __x, int __exp) __attribute__ ((__const__));
  115.  
  116. /* Natural logarithm of x.  */
  117. extern double log (double __x) __attribute__ ((__const__));
  118. extern float logf (float __x) __attribute__ ((__const__));
  119. extern long double logl (long double __x) __attribute__ ((__const__));
  120.  
  121. /* Base-ten logarithm of x.  */
  122. extern double log10 (double __x) __attribute__ ((__const__));
  123. extern float log10f (float __x) __attribute__ ((__const__));
  124. extern long double log10l (long double __x) __attribute__ ((__const__));
  125.  
  126. /* Break value into integral and fractional parts.  */
  127. extern double modf (double __value, double *__iprt);
  128. extern float modff (float __value, float *__iprt);
  129. extern long double modfl (long double __value, long double *__iprt);
  130.  
  131. /* Power functions.  */
  132.  
  133. /* Return x to the y power.  */
  134. extern double pow (double __x, double __y) __attribute__ ((__const__));
  135. extern float powf (float __x, float __y) __attribute__ ((__const__));
  136. extern long double powl (long double __x,
  137.                          long double __y) __attribute__ ((__const__));
  138.  
  139. /* Return the square root of x.  */
  140. extern double sqrt (double __x) __attribute__ ((__const__));
  141.  
  142. /* Nearest integer, absolute value, and remainder functions.  */
  143.  
  144. /* Smallest integral value not less than X.  */
  145. extern double ceil (double __x) __attribute__ ((__const__));
  146. extern float ceilf (float __x) __attribute__ ((__const__));
  147. extern long double ceill (long double __x) __attribute__ ((__const__));
  148.  
  149. /* Absolute value of X.  */
  150. extern double fabs (double __x) __attribute__ ((__const__));
  151.  
  152.  
  153. /* Largest integer not greater than X.  */
  154. extern double floor (double __x) __attribute__ ((__const__));
  155. extern float floorf (float __x) __attribute__ ((__const__));
  156. extern long double floorl (long double __x) __attribute__ ((__const__));
  157.  
  158. /* Nearest integer to X, away from 0 as a double.  */
  159. extern double round (double __x) __attribute__ ((__const__));
  160.  
  161. /* Nearest integer to X, away from 0 as a long int.  */
  162. extern long lround (double __x) __attribute__ ((__const__));
  163.  
  164. #ifdef __GNUC__
  165. /* Nearest integer to X, away from 0 as a long long.  */
  166. extern long long llround (double __x) __attribute__ ((__const__));
  167. #endif
  168.  
  169. /* Floating-point modulo remainder of X/Y.  */
  170. extern double fmod (double __x, double __y) __attribute__ ((__const__));
  171. extern float fmodf (float __x, float __y) __attribute__ ((__const__));
  172. extern long double fmodl (long double __x,
  173.                           long double __y) __attribute__ ((__const__));
  174.  
  175. /* Hypotenuese of x and y.  */
  176. extern double hypot (double __x, double __y) __attribute__ ((__const__));
  177.  
  178. /* (Exponent of x) minus 1.  */
  179. extern double expm1 (double __x) __attribute__ ((__const__));
  180.  
  181. /* Natural logarithm of (x plus 1).  */
  182. extern double log1p (double __x) __attribute__ ((__const__));
  183.  
  184. /* Return 1 if x is infinite, else 0. */
  185. extern int isinf (double __x) __attribute__ ((__const__));
  186.  
  187. /* Return 1 if x is Not A Number, else 0.  */
  188. extern int isnan (double __x) __attribute__ ((__const__));
  189.  
  190. /* Return cube root of x. */
  191. extern double cbrt (double __x) __attribute__ ((__const__));
  192.  
  193. /* Return 1 is x is finite, else 0.  */
  194. extern int finite (double __x) __attribute__ ((__const__));
  195.  
  196. /* Return a value with magnitude of x and with the sign bit of y.  */
  197. extern double copysign (double __x, double __y) __attribute__ ((__const__));
  198.  
  199. /* Return the next machine floating-point number of x in the
  200.    direction toward y.  */
  201. extern double nextafter (double __x, double __y) __attribute__ ((__const__));
  202.  
  203. /* Return x rounded to integral value according to the prevailing
  204.    rounding mode.  */
  205. extern double rint (double __x) __attribute__ ((__const__));
  206.  
  207. /* Return x*(2^n) computed by exponent manipulation rather than
  208.    by actually performing an exponentiation or a multiplication.  */
  209. extern double scalbn (double __x, int __n) __attribute__ ((__const__));
  210.  
  211. /* Return x rounded toward +inf to integral value. */
  212. extern double ceil (double __x) __attribute__ ((__const__));
  213.  
  214. /* Return x rounded toward -inf to integral value.  */
  215. extern double floor (double __x) __attribute__ ((__const__));
  216.  
  217.  
  218. #ifdef __cplusplus
  219. }
  220. #endif
  221.  
  222. #endif
  223.