4 #ifndef RUDIMENTS_MATH_H
5 #define RUDIMENTS_MATH_H
7 #include <rudiments/private/mathincludes.h>
9 #ifdef RUDIMENTS_NAMESPACE
13 class RUDIMENTS_DLLSPEC
math {
15 static int32_t absoluteValue(int32_t j);
16 static div_t divide(int32_t numer, int32_t denom);
18 static long absoluteValue(
long j);
19 static ldiv_t divide(
long numer,
long denom);
21 static int64_t absoluteValue(int64_t j);
22 static lldiv_t divide(int64_t numer, int64_t denom);
24 static bool isFinite(
float x);
25 static bool isInfinite(
float x);
27 static bool isNaN(
float x);
28 static bool areNaN(
float x,
float y);
30 static bool isNormal(
float x);
31 static bool isSubNormal(
float x);
33 static bool isGreater(
float x,
float y);
34 static bool isGreaterOrEqual(
float x,
float y);
35 static bool isLess(
float x,
float y);
36 static bool isLessOrEqual(
float x,
float y);
37 static bool isLessOrGreater(
float x,
float y);
39 static bool isSignBitSet(
float x);
40 static float copySignBit(
float x,
float y);
42 static float arcCosine(
float x);
43 static float arcSine(
float x);
44 static float arcTangent(
float x);
45 static float arcTangent(
float y,
float x);
47 static float cosine(
float x);
48 static float sine(
float x);
49 static float tangent(
float x);
51 static float hyperbolicArcCosine(
float x);
52 static float hyperbolicArcSine(
float x);
53 static float hyperbolicArcTangent(
float x);
55 static float hyperbolicCosine(
float x);
56 static float hyperbolicSine(
float x);
57 static float hyperbolicTangent(
float x);
59 static float naturalExponent(
float x);
60 static float naturalLog(
float x);
61 static float naturalExponentMinusOne(
float x);
62 static float naturalLogPlusOne(
float x);
64 static float exponent(
float x);
66 static float normalize(
float x, int32_t *exp);
68 static float logBase10(
float x);
70 static float exponentBase2(
float x);
71 static float logBase2(
float x);
73 static float power(
float x,
float y);
75 static float squareRoot(
float x);
76 static float cubeRoot(
float x);
78 static float hypotenuse(
float x,
float y);
80 static float computeExponent(
float x);
81 static int32_t integralExponent(
float x);
82 static float loadExponent(
float x, int32_t exp);
84 static float ceiling(
float x);
85 static float floor(
float x);
86 static float absoluteValue(
float x);
88 static float remainder(
float x,
float y);
89 static float remainder(
float x,
float y, int32_t *quo);
91 static float truncate(
float x);
92 static float nearbyInteger(
float x);
93 static float round(
float x);
94 static float roundInexact(
float x);
95 static long roundToLong(
float x);
96 static int64_t roundToLongLong(
float x);
97 static long roundAwayFromZeroToLong(
float x);
98 static int64_t roundAwayFromZeroToLongLong(
float x);
99 static float nextAfter(
float x,
float y);
100 static float nextToward(
float x,
float y);
102 static float errorFunction(
float x);
103 static float complementaryErrorFunction(
float x);
105 static float trueGamma(
float x);
106 static float naturalLogGamma(
float x);
108 static float scaleByRadixToPower(
float x,
float n);
109 static float scaleByRadixToPower(
float x, int32_t n);
110 static float scaleByRadixToPower(
float x,
long n);
112 static float larger(
float x,
float y);
113 static float smaller(
float x,
float y);
115 static float multiplyAndAdd(
float x,
float y,
float z);
116 static float positiveDifference(
float x,
float y);
118 static float argument(
float complex z);
119 static float complex conjugate(
float complex z);
120 static float complex project(
float complex z);
121 static float imaginary(
float complex z);
122 static float real(
float complex z);
128 static bool isFinite(
double x);
129 static bool isInfinite(
double x);
131 static bool isNaN(
double x);
132 static bool areNaN(
double x,
double y);
134 static bool isNormal(
double x);
135 static bool isSubNormal(
double x);
137 static bool isGreater(
double x,
double y);
138 static bool isGreaterOrEqual(
double x,
double y);
139 static bool isLess(
double x,
double y);
140 static bool isLessOrEqual(
double x,
double y);
141 static bool isLessOrGreater(
double x,
double y);
143 static bool isSignBitSet(
double x);
144 static double copySignBit(
double x,
double y);
146 static double arcCosine(
double x);
147 static double arcSine(
double x);
148 static double arcTangent(
double x);
149 static double arcTangent(
double y,
double x);
151 static double cosine(
double x);
152 static double sine(
double x);
153 static double tangent(
double x);
155 static double hyperbolicArcCosine(
double x);
156 static double hyperbolicArcSine(
double x);
157 static double hyperbolicArcTangent(
double x);
159 static double hyperbolicCosine(
double x);
160 static double hyperbolicSine(
double x);
161 static double hyperbolicTangent(
double x);
163 static double naturalExponent(
double x);
164 static double naturalLog(
double x);
165 static double naturalExponentMinusOne(
double x);
166 static double naturalLogPlusOne(
double x);
168 static double exponent(
double x);
170 static double normalize(
double x, int32_t *exp);
172 static double logBase10(
double x);
174 static double exponentBase2(
double x);
175 static double logBase2(
double x);
177 static double power(
double x,
double y);
179 static double squareRoot(
double x);
180 static double cubeRoot(
double x);
182 static double hypotenuse(
double x,
double y);
184 static double computeExponent(
double x);
185 static int32_t integralExponent(
double x);
186 static double loadExponent(
double x, int32_t exp);
188 static double ceiling(
double x);
189 static double floor(
double x);
190 static double absoluteValue(
double x);
192 static double remainder(
double x,
double y);
193 static double remainder(
double x,
double y, int32_t *quo);
195 static double truncate(
double x);
196 static double nearbyInteger(
double x);
197 static double round(
double x);
198 static double roundInexact(
double x);
199 static long roundToLong(
double x);
200 static int64_t roundToLongLong(
double x);
201 static long roundAwayFromZeroToLong(
double x);
202 static int64_t roundAwayFromZeroToLongLong(
double x);
203 static double nextAfter(
double x,
double y);
204 static double nextToward(
double x,
double y);
206 static double errorFunction(
double x);
207 static double complementaryErrorFunction(
double x);
209 static double trueGamma(
double x);
210 static double naturalLogGamma(
double x);
212 static double scaleByRadixToPower(
double x,
double n);
213 static double scaleByRadixToPower(
double x, int32_t n);
214 static double scaleByRadixToPower(
double x,
long n);
216 static double larger(
double x,
double y);
217 static double smaller(
double x,
double y);
219 static double multiplyAndAdd(
double x,
double y,
double z);
220 static double positiveDifference(
double x,
double y);
222 static double argument(
double complex z);
223 static double complex conjugate(
double complex z);
224 static double complex project(
double complex z);
225 static double imaginary(
double complex z);
226 static double real(
double complex z);
230 static bool isFinite(
long double x);
231 static bool isInfinite(
long double x);
233 static bool isNaN(
long double x);
234 static bool areNaN(
long double x,
long double y);
236 static bool isNormal(
long double x);
237 static bool isSubNormal(
long double x);
239 static bool isGreater(
long double x,
long double y);
240 static bool isGreaterOrEqual(
long double x,
long double y);
241 static bool isLess(
long double x,
long double y);
242 static bool isLessOrEqual(
long double x,
long double y);
243 static bool isLessOrGreater(
long double x,
long double y);
245 static bool isSignBitSet(
long double x);
246 static long double copySignBit(
long double x,
249 static long double arcCosine(
long double x);
250 static long double arcSine(
long double x);
251 static long double arcTangent(
long double x);
252 static long double arcTangent(
long double y,
255 static long double cosine(
long double x);
256 static long double sine(
long double x);
257 static long double tangent(
long double x);
259 static long double hyperbolicArcCosine(
long double x);
260 static long double hyperbolicArcSine(
long double x);
261 static long double hyperbolicArcTangent(
long double x);
263 static long double hyperbolicCosine(
long double x);
264 static long double hyperbolicSine(
long double x);
265 static long double hyperbolicTangent(
long double x);
267 static long double naturalExponent(
long double x);
268 static long double naturalLog(
long double x);
269 static long double naturalExponentMinusOne(
long double x);
270 static long double naturalLogPlusOne(
long double x);
272 static long double exponent(
long double x);
274 static long double normalize(
long double x, int32_t *exp);
276 static long double logBase10(
long double x);
278 static long double exponentBase2(
long double x);
279 static long double logBase2(
long double x);
281 static long double power(
long double x,
long double y);
283 static long double squareRoot(
long double x);
284 static long double cubeRoot(
long double x);
286 static long double hypotenuse(
long double x,
289 static long double computeExponent(
long double x);
290 static int32_t integralExponent(
long double x);
291 static long double loadExponent(
long double x,
294 static long double ceiling(
long double x);
295 static long double floor(
long double x);
296 static long double absoluteValue(
long double x);
298 static long double remainder(
long double x,
300 static long double remainder(
long double x,
304 static long double truncate(
long double x);
305 static long double nearbyInteger(
long double x);
306 static long double round(
long double x);
307 static long double roundInexact(
long double x);
308 static long roundToLong(
long double x);
309 static int64_t roundToLongLong(
long double x);
310 static long roundAwayFromZeroToLong(
long double x);
311 static int64_t roundAwayFromZeroToLongLong(
313 static long double nextAfter(
long double x,
315 static long double nextToward(
long double x,
318 static long double errorFunction(
long double x);
319 static long double complementaryErrorFunction(
322 static long double trueGamma(
long double x);
323 static long double naturalLogGamma(
long double x);
326 static long double scaleByRadixToPower(
long double x,
328 static long double scaleByRadixToPower(
long double x,
330 static long double scaleByRadixToPower(
long double x,
333 static long double larger(
long double x,
long double y);
334 static long double smaller(
long double x,
long double y);
336 static long double multiplyAndAdd(
long double x,
339 static long double positiveDifference(
long double x,
342 static long double argument(
long double complex z);
343 static long double complex conjugate(
long double complex z);
344 static long double complex project(
long double complex z);
345 static long double imaginary(
long double complex z);
346 static long double real(
long double complex z);
358 #ifdef RUDIMENTS_NAMESPACE
362 #ifdef ENABLE_RUDIMENTS_INLINES
363 #include <rudiments/private/mathinlines.h>