1 /******************************************************************************
2 *
3 * Copyright (C) 2008, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * Author: Alexey Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13
14 /*-----------------------------------------------------------------------------
15 * Id: math L "Math"
16 *
17 * Summary: Mathematical functions.
18 *
19 * List: *, abs, acos, asin, atan, ceil, cos, exp, fabs, floor, ln, log,
20 modf, pow, sin, sqrt, tan
21 *
22 -----------------------------------------------------------------------------*/
23
24 /*-----------------------------------------------------------------------------
25 * Id: abs F
26 *
27 * Summary: The absolute value for integers |x|.
28 *
29 * Params: x - An integer value.
30 *
31 * Return: The absolute value.
32 *
33 -----------------------------------------------------------------------------*/
34
35 func uint abs( int x )
36
37 /*-----------------------------------------------------------------------------
38 * Id: acos F
39 *
40 * Summary: Calculating the arc cosine.
41 *
42 * Params: x - A value for calculating the arc cosine.
43 *
44 * Return: The arc cosine of x within the range [ 0; PI ].
45 *
46 -----------------------------------------------------------------------------*/
47
48 func double acos( double x )
49
50 /*-----------------------------------------------------------------------------
51 * Id: asin F
52 *
53 * Summary: Calculating the arc sine.
54 *
55 * Params: x - A value for calculating the arc sine.
56 *
57 * Return: The arc cosine of x within the range [ -PI/2 ; PI/2 ].
58 *
59 -----------------------------------------------------------------------------*/
60
61 func double asin( double x )
62
63 /*-----------------------------------------------------------------------------
64 * Id: atan F
65 *
66 * Summary: Calculating the arc tangent.
67 *
68 * Params: x - A value for calculating the arc tangent.
69 *
70 * Return: The arc tangent of x within the range [ -PI/2 ; PI/2 ].
71 *
72 -----------------------------------------------------------------------------*/
73
74 func double atan( double x )
75
76 /*-----------------------------------------------------------------------------
77 * Id: ceil F
78 *
79 * Desc: Smallest double integer not less than given.
80 * Summary: Getting the smallest integer that is greater than or equal to x.
81 *
82 * Params: x - Floating-point value.
83 *
84 * Return: The closest least integer.
85 *
86 -----------------------------------------------------------------------------*/
87
88 func double ceil( double x )
89
90 /*-----------------------------------------------------------------------------
91 * Id: cos F
92 *
93 * Summary: Calculating the cosine.
94 *
95 * Params: x - An angle in radians.
96 *
97 * Return: The cosine of x.
98 *
99 -----------------------------------------------------------------------------*/
100
101 func double cos( double x )
102
103 /*-----------------------------------------------------------------------------
104 * Id: exp F
105 *
106 * Summary: Exponential function.
107 *
108 * Params: x - A power for the number e.
109 *
110 * Return: The number e raised to the power of x.
111 *
112 -----------------------------------------------------------------------------*/
113
114 func double exp( double x )
115
116 /*-----------------------------------------------------------------------------
117 * Id: fabs F
118 *
119 * Summary: The absolute value for double |x|.
120 *
121 * Params: x - Floating-point value.
122 *
123 * Return: The absolute value.
124 *
125 -----------------------------------------------------------------------------*/
126
127 func double fabs( double x )
128
129 /*-----------------------------------------------------------------------------
130 * Id: floor F
131 *
132 * Desc: Largest double integer not greater than given.
133 * Summary: Getting the largest integer that is less than or equal to x.
134 *
135 * Params: x - Floating-point value.
136 *
137 * Return: The closest greatest integer.
138 *
139 -----------------------------------------------------------------------------*/
140
141 func double floor( double x )
142
143 /*-----------------------------------------------------------------------------
144 * Id: ln F
145 *
146 * Summary: Natural logarithm.
147 *
148 * Params: x - Floating-point value.
149 *
150 * Return: The natural logarithm ln( x ).
151 *
152 -----------------------------------------------------------------------------*/
153
154 func double ln( double x )
155
156 /*-----------------------------------------------------------------------------
157 * Id: log F
158 *
159 * Summary: Common logarithm.
160 *
161 * Params: x - Floating-point value.
162 *
163 * Return: The common logarithm log10( x ).
164 *
165 -----------------------------------------------------------------------------*/
166
167 func double log( double x )
168
169 /*-----------------------------------------------------------------------------
170 * Id: modf F
171 *
172 * Summary: Splitting into whole and fractional parts.
173 *
174 * Params: x - Floating-point value.
175 y - A pointer to double for getting the whole part.
176 *
177 * Return: The fractional part of x.
178 *
179 -----------------------------------------------------------------------------*/
180
181 func double modf( double x, uint y )
182
183 /*-----------------------------------------------------------------------------
184 * Id: pow F
185 *
186 * Summary: Raising to the power.
187 *
188 * Params: x - A base.
189 y - A power.
190 *
191 * Return: Raising x to the power of y.
192 *
193 -----------------------------------------------------------------------------*/
194
195 func double pow( double x, double y )
196
197 /*-----------------------------------------------------------------------------
198 * Id: sin F
199 *
200 * Summary: Calculating the sine.
201 *
202 * Params: x - An angle in radians.
203 *
204 * Return: The sine of x.
205 *
206 -----------------------------------------------------------------------------*/
207
208 func double sin( double x )
209
210 /*-----------------------------------------------------------------------------
211 * Id: sqrt F
212 *
213 * Summary: Square root.
214 *
215 * Params: x - A positive floating-point value.
216 *
217 * Return: The square root of x.
218 *
219 -----------------------------------------------------------------------------*/
220
221 func double sqrt( double x )
222
223 /*-----------------------------------------------------------------------------
224 ** Id: tan F
225 *
226 * Summary: Calculating the tangent.
227 *
228 * Params: x - An angle in radians.
229 *
230 * Return: The tangent of x.
231 *
232 -----------------------------------------------------------------------------*/
233
234 func double tan( double x )
235
Редактировать