Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2875 dpurdie 1
#pragma force_top_level
2
#pragma include_only_once
3
 
4
/*
5
 * math.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.5
6
 * Copyright (C) Codemist Ltd., 1988
7
 * Copyright 1991-1998 ARM Limited. All rights reserved
8
 */
9
 
10
/*
11
 * RCS $Revision: 1.8.4.3 $ Codemist 0.03
12
 * Checkin $Date: 1998/10/02 13:31:33 $
13
 * Revising $Author: wdijkstr $
14
 */
15
 
16
#ifndef __math_h
17
#define __math_h
18
 
19
#ifdef __cplusplus
20
extern "C" {
21
#endif
22
 
23
#ifdef __TARGET_FPU_VFP
24
/* Temporary expedient, pending a library implementation */
25
/* fp arguments and results both in integer regoisters */
26
#  pragma -g2
27
#endif
28
 
29
#ifndef HUGE_VAL
30
#  define HUGE_VAL __huge_val
31
extern const double HUGE_VAL;
32
#endif
33
 
34
/* Be careful with __pure.
35
   Nothing taking a pointer argument can safely be declared to be so
36
   (how can CSE know whether the thing pointed to has been updated, or
37
    whether indeed the argument is not an output).
38
   Nor may things which set errno - a side effect -.
39
 */
40
 
41
extern double acos(double /*x*/);
42
   /* computes the principal value of the arc cosine of x */
43
   /* a domain error occurs for arguments not in the range -1 to 1 */
44
   /* Returns: the arc cosine in the range 0 to Pi. */
45
extern double asin(double /*x*/);
46
   /* computes the principal value of the arc sine of x */
47
   /* a domain error occurs for arguments not in the range -1 to 1 */
48
   /* and -HUGE_VAL is returned. */
49
   /* Returns: the arc sine in the range -Pi/2 to Pi/2. */
50
 
51
extern __pure double atan(double /*x*/);
52
   /* computes the principal value of the arc tangent of x */
53
   /* Returns: the arc tangent in the range -Pi/2 to Pi/2. */
54
 
55
extern double atan2(double /*y*/, double /*x*/);
56
   /* computes the principal value of the arc tangent of y/x, using the */
57
   /* signs of both arguments to determine the quadrant of the return value */
58
   /* a domain error occurs if both args are zero, and -HUGE_VAL returned. */
59
   /* Returns: the arc tangent of y/x, in the range -Pi to Pi. */
60
 
61
 
62
extern __pure double cos(double /*x*/);
63
   /* computes the cosine of x (measured in radians). A large magnitude */
64
   /* argument may yield a result with little or no significance */
65
   /* Returns: the cosine value. */
66
extern __pure double sin(double /*x*/);
67
   /* computes the sine of x (measured in radians). A large magnitude */
68
   /* argument may yield a result with little or no significance */
69
   /* Returns: the sine value. */
70
 
71
extern double tan(double /*x*/);
72
   /* computes the tangent of x (measured in radians). A large magnitude */
73
   /* argument may yield a result with little or no significance */
74
   /* Returns: the tangent value. */
75
   /*          if range error; returns HUGE_VAL. */
76
 
77
extern double cosh(double /*x*/);
78
   /* computes the hyperbolic cosine of x. A range error occurs if the */
79
   /* magnitude of x is too large. */
80
   /* Returns: the hyperbolic cosine value. */
81
   /*          if range error; returns HUGE_VAL. */
82
extern double sinh(double /*x*/);
83
   /* computes the hyperbolic sine of x. A range error occurs if the */
84
   /* magnitude of x is too large. */
85
   /* Returns: the hyperbolic sine value. */
86
   /*          if range error; returns -HUGE_VAL or HUGE_VAL depending */
87
   /*          on the sign of the argument */
88
 
89
extern __pure double tanh(double /*x*/);
90
   /* computes the hyperbolic tangent of x. */
91
   /* Returns: the hyperbolic tangent value. */
92
 
93
extern double exp(double /*x*/);
94
   /* computes the exponential function of x. A range error occurs if the */
95
   /* magnitude of x is too large. */
96
   /* Returns: the exponential value. */
97
   /*          if underflow range error; 0 is returned. */
98
   /*          if overflow range error; HUGE_VAL is returned. */
99
 
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
 
108
extern double ldexp(double /*x*/, int /*exp*/);
109
   /* multiplies a floating-point number by an integral power of 2. */
110
   /* A range error may occur. */
111
   /* Returns: the value of x times 2 raised to the power of exp. */
112
   /*          if range error; HUGE_VAL is returned. */
113
extern double log(double /*x*/);
114
   /* computes the natural logarithm of x. A domain error occurs if the */
115
   /* argument is negative, and -HUGE_VAL is returned. A range error occurs */
116
   /* if the argument is zero. */
117
   /* Returns: the natural logarithm. */
118
   /*          if range error; -HUGE_VAL is returned. */
119
extern double log10(double /*x*/);
120
   /* computes the base-ten logarithm of x. A domain error occurs if the */
121
   /* argument is negative. A range error occurs if the argument is zero. */
122
   /* Returns: the base-ten logarithm. */
123
extern double modf(double /*value*/, double * /*iptr*/);
124
   /* breaks the argument value into integral and fraction parts, each of */
125
   /* which has the same sign as the argument. It stores the integral part */
126
   /* as a double in the object pointed to by iptr. */
127
   /* Returns: the signed fractional part of value. */
128
 
129
extern double pow(double /*x*/, double /*y*/);
130
   /* computes x raised to the power of y. A domain error occurs if x is */
131
   /* zero and y is less than or equal to zero, or if x is negative and y */
132
   /* is not an integer, and -HUGE_VAL returned. A range error may occur. */
133
   /* Returns: the value of x raised to the power of y. */
134
   /*          if underflow range error; 0 is returned. */
135
   /*          if overflow range error; HUGE_VAL is returned. */
136
extern double sqrt(double /*x*/);
137
   /* computes the non-negative square root of x. A domain error occurs */
138
   /* if the argument is negative, and -HUGE_VAL returned. */
139
   /* Returns: the value of the square root. */
140
 
141
extern __pure double ceil(double /*x*/);
142
   /* computes the smallest integer not less than x. */
143
   /* Returns: the smallest integer not less than x, expressed as a double. */
144
extern __pure double fabs(double /*x*/);
145
   /* computes the absolute value of the floating-point number x. */
146
   /* Returns: the absolute value of x. */
147
 
148
extern __pure double __d_abs(double);  /* inline expansion of fabs() */
149
 
150
extern __pure double floor(double /*d*/);
151
   /* computes the largest integer not greater than x. */
152
   /* Returns: the largest integer not greater than x, expressed as a double */
153
 
154
extern double fmod(double /*x*/, double /*y*/);
155
   /* computes the floating-point remainder of x/y. */
156
   /* Returns: the value x - i * y, for some integer i such that, if y is */
157
   /*          nonzero, the result has the same sign as x and magnitude */
158
   /*          less than the magnitude of y. If y is zero, a domain error */
159
   /*          occurs and -HUGE_VAL is returned. */
160
 
161
#ifdef __TARGET_FPU_FPA
162
#  define fabs(x) __d_abs(x)
163
#endif
164
 
165
#ifdef __TARGET_FPU_VFP
166
/* Temporary expedient, pending a library implementation */
167
/* fp arguments and results both in integer registers */
168
#  pragma -g0
169
#endif
170
 
171
#ifdef __cplusplus
172
}
173
#endif
174
 
175
#endif
176
 
177
/* end of math.h */