1 | /* |
---|
2 | * math.h - User level <math> library definition. |
---|
3 | * |
---|
4 | * Author Alain Greiner (2016,2017,2018) |
---|
5 | * |
---|
6 | * Copyright (c) UPMC Sorbonne Universites |
---|
7 | * |
---|
8 | * This file is part of ALMOS-MKH. |
---|
9 | * |
---|
10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
11 | * under the terms of the GNU General Public License as published by |
---|
12 | * the Free Software Foundation; version 2.0 of the License. |
---|
13 | * |
---|
14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | * General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef MATH_H_ |
---|
25 | #define MATH_H_ |
---|
26 | |
---|
27 | /***************************************************************************************** |
---|
28 | * This file defines the user level, mathematical functions library. |
---|
29 | * Most of this code is a modification of the <ulibc> library, developped by Sun |
---|
30 | * Microsystem Inc in 1993, and ported to the ALMOS-MKH 0S in August 2018. |
---|
31 | ****************************************************************************************/ |
---|
32 | |
---|
33 | |
---|
34 | /***************************************************************************************** |
---|
35 | * This function returns the absolute value of the <x> argument. |
---|
36 | ****************************************************************************************/ |
---|
37 | double fabs (double x); |
---|
38 | |
---|
39 | /***************************************************************************************** |
---|
40 | * This function returns the remainder of <x/y>. |
---|
41 | ****************************************************************************************/ |
---|
42 | double fmod (double x, double y); |
---|
43 | |
---|
44 | /***************************************************************************************** |
---|
45 | * This function round to the largest integer value not larger than <x>. |
---|
46 | ****************************************************************************************/ |
---|
47 | double floor (double x); |
---|
48 | |
---|
49 | /***************************************************************************************** |
---|
50 | * This function round to the smallest integer value not less than <x>. |
---|
51 | ****************************************************************************************/ |
---|
52 | double ceil (double x); |
---|
53 | |
---|
54 | /***************************************************************************************** |
---|
55 | * This function returns the sine function of the <x> argument in radian. |
---|
56 | ****************************************************************************************/ |
---|
57 | double sin (double x); |
---|
58 | |
---|
59 | /***************************************************************************************** |
---|
60 | * This function returns the cosine function of the <x> argument in radian. |
---|
61 | ****************************************************************************************/ |
---|
62 | double cos (double x); |
---|
63 | |
---|
64 | /***************************************************************************************** |
---|
65 | * This function returns the value of <x> raised to the power of <y>. |
---|
66 | ****************************************************************************************/ |
---|
67 | double pow (double x, double y); |
---|
68 | |
---|
69 | /***************************************************************************************** |
---|
70 | * This function returns the base-e exponential of <x>. |
---|
71 | ****************************************************************************************/ |
---|
72 | double exp (double x); |
---|
73 | |
---|
74 | /***************************************************************************************** |
---|
75 | * This function returns non-zero if <x> is not a number (NaN). |
---|
76 | ****************************************************************************************/ |
---|
77 | int isnan (double x); |
---|
78 | |
---|
79 | /***************************************************************************************** |
---|
80 | * This function returns non-zero if <x> is infinite. |
---|
81 | ****************************************************************************************/ |
---|
82 | int isfinite(double x); |
---|
83 | |
---|
84 | /***************************************************************************************** |
---|
85 | * These functions return x*(2**n), computed by exponent manipulation. |
---|
86 | ****************************************************************************************/ |
---|
87 | double scalbln (double x, long n); |
---|
88 | double scalbn (double x, int n); |
---|
89 | |
---|
90 | /***************************************************************************************** |
---|
91 | * This function changes the sign of <x> to that of <y>. |
---|
92 | ****************************************************************************************/ |
---|
93 | double copysign(double x, double y); |
---|
94 | |
---|
95 | /***************************************************************************************** |
---|
96 | * This function return the integral value nearest to <x> (according to the |
---|
97 | * prevailing rounding mode) in floating-point format. |
---|
98 | ****************************************************************************************/ |
---|
99 | double rint (double x); |
---|
100 | |
---|
101 | |
---|
102 | #endif |
---|