home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !gcc / include / libscl / h / math < prev    next >
Encoding:
Text File  |  2006-09-17  |  9.5 KB  |  244 lines

  1. /* math.h standard header for the RISC OS SharedCLibrary.
  2.    Copyright (c) 1997-2005 Nick Burrett
  3.    All rights reserved.
  4.  
  5.    Redistribution and use in source and binary forms, with or without
  6.    modification, are permitted provided that the following conditions
  7.    are met:
  8.    1. Redistributions of source code must retain the above copyright
  9.       notice, this list of conditions and the following disclaimer.
  10.    2. Redistributions in binary form must reproduce the above copyright
  11.       notice, this list of conditions and the following disclaimer in the
  12.       documentation and/or other materials provided with the distribution.
  13.    3. The name of the author may not be used to endorse or promote products
  14.       derived from this software without specific prior written permission.
  15.  
  16.    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17.    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18.    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19.    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  20.    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21.    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22.    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23.    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24.    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25.    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  26.  
  27. #ifndef __MATH_H
  28. #define __MATH_H
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #ifndef HUGE_VAL
  35. #define HUGE_VAL __huge_val
  36. extern const double HUGE_VAL;
  37. #endif
  38.  
  39. /* GCC has various useful declarations that can be made with the
  40.    __attribute__ syntax.  Disable its use for other compilers.  */
  41. #ifndef __GNUC__
  42. #ifndef __attribute__
  43. #define __attribute__(x) /* Ignore.  */
  44. #endif
  45. #endif
  46.  
  47. /* Trigonometric functions.  */
  48.  
  49. /* Arc cosine of x.  */
  50. extern double acos (double __x) __attribute__ ((__const__));
  51. extern float acosf (float __x) __attribute__ ((__const__));
  52. extern long double acosl (long double __x) __attribute__ ((__const__));
  53.  
  54. /* Arc sine of x.  */
  55. extern double asin (double __x) __attribute__ ((__const__));
  56. extern float asinf (float __x) __attribute__ ((__const__));
  57. extern long double asinl (long double __x) __attribute__ ((__const__));
  58.  
  59. /* Arc tangent of x.  */
  60. extern double atan (double __x) __attribute__ ((__const__));
  61. extern float atanf (float __x) __attribute__ ((__const__));
  62. extern long double atanl (long double __x) __attribute__ ((__const__));
  63.  
  64. /* Arc tangent of y/x.  */
  65. extern double atan2 (double __y, double __x) __attribute__ ((__const__));
  66. extern float atan2f (float __y, float __x) __attribute__ ((__const__));
  67. extern long double atan2l (long double __y,
  68.                            long double __x) __attribute__ ((__const__));
  69.  
  70. /* Cosine of x.  */
  71. extern double cos (double __x) __attribute__ ((__const__));
  72. extern float cosf (float __x) __attribute__ ((__const__));
  73. extern long double cosl (long double __x) __attribute__ ((__const__));
  74.  
  75. /* Sine of x.  */
  76. extern double sin (double __x) __attribute__ ((__const__));
  77. extern float sinf (float __x) __attribute__ ((__const__));
  78. extern long double sinl (long double __x) __attribute__ ((__const__));
  79.  
  80. /* Tangent of x.  */
  81. extern double tan (double __x) __attribute__ ((__const__));
  82. extern float tanf (float __x) __attribute__ ((__const__));
  83. extern long double tanl (long double __x) __attribute__ ((__const__));
  84.  
  85. /* Hyperbolic functions.  */
  86.  
  87. /* Hyperbolic cosine of x.  */
  88. extern double cosh (double __x) __attribute__ ((__const__));
  89. extern float coshf (float __x) __attribute__ ((__const__));
  90. extern long double coshl (long double __x) __attribute__ ((__const__));
  91.  
  92. /* Hyperbolic sine of x.  */
  93. extern double sinh (double __x) __attribute__ ((__const__));
  94. extern float sinhf (float __x) __attribute__ ((__const__));
  95. extern long double sinhl (long double __x) __attribute__ ((__const__));
  96.  
  97. /* Hyperbolic tangent of x.  */
  98. extern double tanh (double __x) __attribute__ ((__const__));
  99. extern float tanhf (float __x) __attribute__ ((__const__));
  100. extern long double tanhl (long double __x) __attribute__ ((__const__));
  101.  
  102. /* Hyperbolic arc cosine of x.  */
  103. extern double acosh (double __x) __attribute__ ((__const__));
  104.  
  105. /* Hyperbolic arc sine of x.  */
  106. extern double asinh (double __x) __attribute__ ((__const__));
  107.  
  108. /* Hyperbolic arc tangent of x.  */
  109. extern double atanh (double __x) __attribute__ ((__const__));
  110.  
  111. /* Exponential and logarithmic functions.  */
  112.  
  113. /* Exponentional function of x (2 ^ e).  */
  114. extern double exp (double __x) __attribute__ ((__const__));
  115. extern float expf (float __x) __attribute__ ((__const__));
  116. extern long double expl (long double __x) __attribute__ ((__const__));
  117.  
  118. /* Exponentional function of x (2 ^ x).  */
  119. extern double exp2 (double __x) __attribute__ ((__const__));
  120.  
  121. /* Exponentional function of x (10 ^ x).  */
  122. extern double exp10 (double __x) __attribute__ ((__const__));
  123.  
  124. /* Break value into a normalized fracton and an integral power of 2.  */
  125. extern double frexp (double value, int *__exp);
  126. extern float frexpf (float value, int *__exp);
  127. extern long double frexpl (long double value, int *__exp);
  128.  
  129. /* x times (two to the exp power).  */
  130. extern double ldexp (double __x, int __exp) __attribute__ ((__const__));
  131. extern float ldexpf (float __x, int __exp) __attribute__ ((__const__));
  132. extern long double ldexpl (long __x, int __exp) __attribute__ ((__const__));
  133.  
  134. /* scalb is the BSD name for ldexp.  */
  135. extern double scalb (double __x, int __exp) __attribute__ ((__const__));
  136.  
  137. /* Natural logarithm of x.  */
  138. extern double log (double __x) __attribute__ ((__const__));
  139. extern float logf (float __x) __attribute__ ((__const__));
  140. extern long double logl (long double __x) __attribute__ ((__const__));
  141.  
  142. /* Base-ten logarithm of x.  */
  143. extern double log10 (double __x) __attribute__ ((__const__));
  144. extern float log10f (float __x) __attribute__ ((__const__));
  145. extern long double log10l (long double __x) __attribute__ ((__const__));
  146.  
  147. /* Break value into integral and fractional parts.  */
  148. extern double modf (double __value, double *__iprt);
  149. extern float modff (float __value, float *__iprt);
  150. extern long double modfl (long double __value, long double *__iprt);
  151.  
  152. /* Power functions.  */
  153.  
  154. /* Return x to the y power.  */
  155. extern double pow (double __x, double __y) __attribute__ ((__const__));
  156. extern float powf (float __x, float __y) __attribute__ ((__const__));
  157. extern long double powl (long double __x,
  158.                          long double __y) __attribute__ ((__const__));
  159.  
  160. /* Return the square root of x.  */
  161. extern double sqrt (double __x) __attribute__ ((__const__));
  162.  
  163. /* Nearest integer, absolute value, and remainder functions.  */
  164.  
  165. /* Smallest integral value not less than X.  */
  166. extern double ceil (double __x) __attribute__ ((__const__));
  167. extern float ceilf (float __x) __attribute__ ((__const__));
  168. extern long double ceill (long double __x) __attribute__ ((__const__));
  169.  
  170. /* Absolute value of X.  */
  171. extern double fabs (double __x) __attribute__ ((__const__));
  172.  
  173.  
  174. /* Largest integer not greater than X.  */
  175. extern double floor (double __x) __attribute__ ((__const__));
  176. extern float floorf (float __x) __attribute__ ((__const__));
  177. extern long double floorl (long double __x) __attribute__ ((__const__));
  178.  
  179. /* Nearest integer to X, away from 0 as a double.  */
  180. extern double round (double __x) __attribute__ ((__const__));
  181.  
  182. /* Nearest integer to X, away from 0 as a long int.  */
  183. extern long lround (double __x) __attribute__ ((__const__));
  184.  
  185. #ifdef __GNUC__
  186. /* Nearest integer to X, away from 0 as a long long.  */
  187. extern long long llround (double __x) __attribute__ ((__const__));
  188. #endif
  189.  
  190. /* Floating-point modulo remainder of X/Y.  */
  191. extern double fmod (double __x, double __y) __attribute__ ((__const__));
  192. extern float fmodf (float __x, float __y) __attribute__ ((__const__));
  193. extern long double fmodl (long double __x,
  194.                           long double __y) __attribute__ ((__const__));
  195.  
  196. /* Hypotenuese of x and y.  */
  197. extern double hypot (double __x, double __y) __attribute__ ((__const__));
  198.  
  199. /* (Exponent of x) minus 1.  */
  200. extern double expm1 (double __x) __attribute__ ((__const__));
  201.  
  202. /* Natural logarithm of (x plus 1).  */
  203. extern double log1p (double __x) __attribute__ ((__const__));
  204.  
  205. /* Return 1 if x is infinite, else 0. */
  206. extern int isinf (double __x) __attribute__ ((__const__));
  207.  
  208. /* Return 1 if x is Not A Number, else 0.  */
  209. extern int isnan (double __x) __attribute__ ((__const__));
  210.  
  211. /* Return cube root of x. */
  212. extern double cbrt (double __x) __attribute__ ((__const__));
  213.  
  214. /* Return 1 is x is finite, else 0.  */
  215. extern int finite (double __x) __attribute__ ((__const__));
  216.  
  217. /* Return a value with magnitude of x and with the sign bit of y.  */
  218. extern double copysign (double __x, double __y) __attribute__ ((__const__));
  219.  
  220. /* Return the next machine floating-point number of x in the
  221.    direction toward y.  */
  222. extern double nextafter (double __x, double __y) __attribute__ ((__const__));
  223.  
  224. /* Return x rounded to integral value according to the prevailing
  225.    rounding mode.  */
  226. extern double rint (double __x) __attribute__ ((__const__));
  227.  
  228. /* Return x*(2^n) computed by exponent manipulation rather than
  229.    by actually performing an exponentiation or a multiplication.  */
  230. extern double scalbn (double __x, int __n) __attribute__ ((__const__));
  231.  
  232. /* Return x rounded toward +inf to integral value. */
  233. extern double ceil (double __x) __attribute__ ((__const__));
  234.  
  235. /* Return x rounded toward -inf to integral value.  */
  236. extern double floor (double __x) __attribute__ ((__const__));
  237.  
  238.  
  239. #ifdef __cplusplus
  240. }
  241. #endif
  242.  
  243. #endif
  244.