chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / DLLLib / h / math
1 #pragma force_top_level
2 #pragma include_only_once
3
4 /* math.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.5 */
5 /* Copyright (C) Codemist Ltd. */
6 /* Copyright (C) Acorn Computers Ltd. 1991 */
7 /* version 0.02 */
8
9 #ifndef __math_h
10 #define __math_h
11
12 #ifndef HUGE_VAL
13   #define HUGE_VAL __huge_val
14
15   #ifdef __cplusplus
16     #define HUGE __huge_val
17     extern "C" {
18   #endif
19
20   #ifdef _DLL
21     extern const double *_dll_huge_val(void);
22     #define __huge_val (*_dll_huge_val())
23   #else
24     extern const double __huge_val;
25   #endif
26
27   #ifdef __cplusplus
28     }
29   #endif
30
31 #endif
32
33 #pragma no_side_effects
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 extern double acos(double /*x*/);
39    /* computes the principal value of the arc cosine of x */
40    /* a domain error occurs for arguments not in the range -1 to 1 */
41    /* Returns: the arc cosine in the range 0 to Pi. */
42 extern double asin(double /*x*/);
43    /* computes the principal value of the arc sine of x */
44    /* a domain error occurs for arguments not in the range -1 to 1 */
45    /* and -HUGE_VAL is returned. */
46    /* Returns: the arc sine in the range -Pi/2 to Pi/2. */
47 extern double atan(double /*x*/);
48    /* computes the principal value of the arc tangent of x */
49    /* Returns: the arc tangent in the range -Pi/2 to Pi/2. */
50 extern double atan2(double /*x*/, double /*y*/);
51    /* computes the principal value of the arc tangent of y/x, using the */
52    /* signs of both arguments to determine the quadrant of the return value */
53    /* a domain error occurs if both args are zero, and -HUGE_VAL returned. */
54    /* Returns: the arc tangent of y/x, in the range -Pi to Pi. */
55
56 extern double __d_atan(double);
57 #define atan(x) __d_atan(x)
58
59 extern double cos(double /*x*/);
60    /* computes the cosine of x (measured in radians). A large magnitude */
61    /* argument may yield a result with little or no significance */
62    /* Returns: the cosine value. */
63 extern double sin(double /*x*/);
64    /* computes the sine of x (measured in radians). A large magnitude */
65    /* argument may yield a result with little or no significance */
66    /* Returns: the sine value. */
67
68 extern double __d_sin(double);
69 extern double __d_cos(double);
70 #define sin(x) __d_sin(x)
71 #define cos(x) __d_cos(x)
72
73 extern double tan(double /*x*/);
74    /* computes the tangent of x (measured in radians). A large magnitude */
75    /* argument may yield a result with little or no significance */
76    /* Returns: the tangent value. */
77    /*          if range error; returns HUGE_VAL. */
78
79 extern double cosh(double /*x*/);
80    /* computes the hyperbolic cosine of x. A range error occurs if the */
81    /* magnitude of x is too large. */
82    /* Returns: the hyperbolic cosine value. */
83    /*          if range error; returns HUGE_VAL. */
84 extern double sinh(double /*x*/);
85    /* computes the hyperbolic sine of x. A range error occurs if the */
86    /* magnitude of x is too large. */
87    /* Returns: the hyperbolic sine value. */
88    /*          if range error; returns -HUGE_VAL or HUGE_VAL depending */
89    /*          on the sign of the argument */
90 extern double tanh(double /*x*/);
91    /* computes the hyperbolic tangent of x. */
92    /* Returns: the hyperbolic tangent value. */
93
94 extern double exp(double /*x*/);
95    /* computes the exponential function of x. A range error occurs if the */
96    /* magnitude of x is too large. */
97    /* Returns: the exponential value. */
98    /*          if underflow range error; 0 is returned. */
99    /*          if overflow range error; HUGE_VAL is returned. */
100 extern double frexp(double /*value*/, int * /*exp*/);
101    /* breaks a floating-point number into a normalised fraction and an */
102    /* integral power of 2. It stores the integer in the int object pointed */
103    /* to by exp. */
104    /* Returns: the value x, such that x is a double with magnitude in the */
105    /* interval 0.5 to 1.0 or zero, and value equals x times 2 raised to the */
106    /* power *exp. If value is zero, both parts of the result are zero. */
107 extern double ldexp(double /*x*/, int /*exp*/);
108    /* multiplies a floating-point number by an integral power of 2. */
109    /* A range error may occur. */
110    /* Returns: the value of x times 2 raised to the power of exp. */
111    /*          if range error; HUGE_VAL is returned. */
112 extern double log(double /*x*/);
113    /* computes the natural logarithm of x. A domain error occurs if the */
114    /* argument is negative, and -HUGE_VAL is returned. A range error occurs */
115    /* if the argument is zero. */
116    /* Returns: the natural logarithm. */
117    /*          if range error; -HUGE_VAL is returned. */
118 extern double log10(double /*x*/);
119    /* computes the base-ten logarithm of x. A domain error occurs if the */
120    /* argument is negative. A range error occurs if the argument is zero. */
121    /* Returns: the base-ten logarithm. */
122 extern double modf(double /*value*/, double * /*iptr*/);
123    /* breaks the argument value into integral and fraction parts, each of */
124    /* which has the same sign as the argument. It stores the integral part */
125    /* as a double in the object pointed to by iptr. */
126    /* Returns: the signed fractional part of value. */
127
128 extern double pow(double /*x*/, double /*y*/);
129    /* computes x raised to the power of y. A domain error occurs if x is */
130    /* zero and y is less than or equal to zero, or if x is negative and y */
131    /* is not an integer, and -HUGE_VAL returned. A range error may occur. */
132    /* Returns: the value of x raised to the power of y. */
133    /*          if underflow range error; 0 is returned. */
134    /*          if overflow range error; HUGE_VAL is returned. */
135 extern double sqrt(double /*x*/);
136    /* computes the non-negative square root of x. A domain error occurs */
137    /* if the argument is negative, and -HUGE_VAL returned. */
138    /* Returns: the value of the square root. */
139
140 extern double ceil(double /*x*/);
141    /* computes the smallest integer not less than x. */
142    /* Returns: the smallest integer not less than x, expressed as a double. */
143 extern double fabs(double /*x*/);
144    /* computes the absolute value of the floating-point number x. */
145    /* Returns: the absolute value of x. */
146 extern double floor(double /*d*/);
147    /* computes the largest integer not greater than x. */
148    /* Returns: the largest integer not greater than x, expressed as a double */
149 extern double fmod(double /*x*/, double /*y*/);
150    /* computes the floating-point remainder of x/y. */
151    /* Returns: the value x - i * y, for some integer i such that, if y is */
152    /*          nonzero, the result has the same sign as x and magnitude */
153    /*          less than the magnitude of y. If y is zero, a domain error */
154    /*          occurs and -HUGE_VAL is returned. */
155
156 extern double __d_abs(double);
157 #define fabs(x) __d_abs(x)
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #pragma side_effects
164
165 #endif
166
167 /* end of math.h */