• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright JS Foundation and other contributors, http://js.foundation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef JERRY_LIBM_MATH_H
17 #define JERRY_LIBM_MATH_H
18 
19 #ifdef __cplusplus
20 extern "C"
21 {
22 #endif /* __cplusplus */
23 
24 /* General Constants. */
25 #define INFINITY    (1.0/0.0)
26 #define NAN         (0.0/0.0)
27 #define HUGE_VAL    INFINITY
28 
29 #define isnan(x)    ((x) != (x))
30 #define isinf(x)    (((x) == INFINITY) || ((x) == -INFINITY))
31 #define isfinite(x) (!(isinf(x)) && (x != NAN))
32 
33 /* Exponential and Logarithmic constants. */
34 #define M_E        2.7182818284590452353602874713526625
35 #define M_SQRT2    1.4142135623730950488016887242096981
36 #define M_SQRT1_2  0.7071067811865475244008443621048490
37 #define M_LOG2E    1.4426950408889634073599246810018921
38 #define M_LOG10E   0.4342944819032518276511289189166051
39 #define M_LN2      0.6931471805599453094172321214581765
40 #define M_LN10     2.3025850929940456840179914546843642
41 
42 /* Trigonometric Constants. */
43 #define M_PI       3.1415926535897932384626433832795029
44 #define M_PI_2     1.5707963267948966192313216916397514
45 #define M_PI_4     0.7853981633974483096156608458198757
46 #define M_1_PI     0.3183098861837906715377675267450287
47 #define M_2_PI     0.6366197723675813430755350534900574
48 #define M_2_SQRTPI 1.1283791670955125738961589031215452
49 
50 /* Trigonometric functions. */
51 double cos (double);
52 double sin (double);
53 double tan (double);
54 double acos (double);
55 double asin (double);
56 double atan (double);
57 double atan2 (double, double);
58 
59 /* Hyperbolic functions. */
60 double cosh (double x);
61 double sinh (double x);
62 double tanh (double x);
63 
64 /* Inverse hyperbolic functions */
65 double acosh (double);
66 double asinh (double);
67 double atanh (double);
68 
69 /* Exponential and logarithmic functions. */
70 double exp (double);
71 double expm1 (double);
72 double log (double);
73 double log1p (double);
74 double log2 (double);
75 double log10 (double);
76 
77 /* Power functions. */
78 double pow (double, double);
79 double sqrt (double);
80 double cbrt (double);
81 
82 /* Rounding and remainder functions. */
83 double ceil (double);
84 double floor (double);
85 
86 /* Other functions. */
87 double fabs (double);
88 double fmod (double, double);
89 
90 double nextafter (double, double);
91 
92 #ifdef __cplusplus
93 }
94 #endif /* __cplusplus */
95 #endif /* !JERRY_LIBM_MATH_H */
96