1425bb815Sopenharmony_ci/* Copyright JS Foundation and other contributors, http://js.foundation 2425bb815Sopenharmony_ci * 3425bb815Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4425bb815Sopenharmony_ci * you may not use this file except in compliance with the License. 5425bb815Sopenharmony_ci * You may obtain a copy of the License at 6425bb815Sopenharmony_ci * 7425bb815Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8425bb815Sopenharmony_ci * 9425bb815Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10425bb815Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS 11425bb815Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12425bb815Sopenharmony_ci * See the License for the specific language governing permissions and 13425bb815Sopenharmony_ci * limitations under the License. 14425bb815Sopenharmony_ci */ 15425bb815Sopenharmony_ci 16425bb815Sopenharmony_ci#ifndef JERRY_LIBM_MATH_H 17425bb815Sopenharmony_ci#define JERRY_LIBM_MATH_H 18425bb815Sopenharmony_ci 19425bb815Sopenharmony_ci#ifdef __cplusplus 20425bb815Sopenharmony_ciextern "C" 21425bb815Sopenharmony_ci{ 22425bb815Sopenharmony_ci#endif /* __cplusplus */ 23425bb815Sopenharmony_ci 24425bb815Sopenharmony_ci/* General Constants. */ 25425bb815Sopenharmony_ci#define INFINITY (1.0/0.0) 26425bb815Sopenharmony_ci#define NAN (0.0/0.0) 27425bb815Sopenharmony_ci#define HUGE_VAL INFINITY 28425bb815Sopenharmony_ci 29425bb815Sopenharmony_ci#define isnan(x) ((x) != (x)) 30425bb815Sopenharmony_ci#define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY)) 31425bb815Sopenharmony_ci#define isfinite(x) (!(isinf(x)) && (x != NAN)) 32425bb815Sopenharmony_ci 33425bb815Sopenharmony_ci/* Exponential and Logarithmic constants. */ 34425bb815Sopenharmony_ci#define M_E 2.7182818284590452353602874713526625 35425bb815Sopenharmony_ci#define M_SQRT2 1.4142135623730950488016887242096981 36425bb815Sopenharmony_ci#define M_SQRT1_2 0.7071067811865475244008443621048490 37425bb815Sopenharmony_ci#define M_LOG2E 1.4426950408889634073599246810018921 38425bb815Sopenharmony_ci#define M_LOG10E 0.4342944819032518276511289189166051 39425bb815Sopenharmony_ci#define M_LN2 0.6931471805599453094172321214581765 40425bb815Sopenharmony_ci#define M_LN10 2.3025850929940456840179914546843642 41425bb815Sopenharmony_ci 42425bb815Sopenharmony_ci/* Trigonometric Constants. */ 43425bb815Sopenharmony_ci#define M_PI 3.1415926535897932384626433832795029 44425bb815Sopenharmony_ci#define M_PI_2 1.5707963267948966192313216916397514 45425bb815Sopenharmony_ci#define M_PI_4 0.7853981633974483096156608458198757 46425bb815Sopenharmony_ci#define M_1_PI 0.3183098861837906715377675267450287 47425bb815Sopenharmony_ci#define M_2_PI 0.6366197723675813430755350534900574 48425bb815Sopenharmony_ci#define M_2_SQRTPI 1.1283791670955125738961589031215452 49425bb815Sopenharmony_ci 50425bb815Sopenharmony_ci/* Trigonometric functions. */ 51425bb815Sopenharmony_cidouble cos (double); 52425bb815Sopenharmony_cidouble sin (double); 53425bb815Sopenharmony_cidouble tan (double); 54425bb815Sopenharmony_cidouble acos (double); 55425bb815Sopenharmony_cidouble asin (double); 56425bb815Sopenharmony_cidouble atan (double); 57425bb815Sopenharmony_cidouble atan2 (double, double); 58425bb815Sopenharmony_ci 59425bb815Sopenharmony_ci/* Hyperbolic functions. */ 60425bb815Sopenharmony_cidouble cosh (double x); 61425bb815Sopenharmony_cidouble sinh (double x); 62425bb815Sopenharmony_cidouble tanh (double x); 63425bb815Sopenharmony_ci 64425bb815Sopenharmony_ci/* Inverse hyperbolic functions */ 65425bb815Sopenharmony_cidouble acosh (double); 66425bb815Sopenharmony_cidouble asinh (double); 67425bb815Sopenharmony_cidouble atanh (double); 68425bb815Sopenharmony_ci 69425bb815Sopenharmony_ci/* Exponential and logarithmic functions. */ 70425bb815Sopenharmony_cidouble exp (double); 71425bb815Sopenharmony_cidouble expm1 (double); 72425bb815Sopenharmony_cidouble log (double); 73425bb815Sopenharmony_cidouble log1p (double); 74425bb815Sopenharmony_cidouble log2 (double); 75425bb815Sopenharmony_cidouble log10 (double); 76425bb815Sopenharmony_ci 77425bb815Sopenharmony_ci/* Power functions. */ 78425bb815Sopenharmony_cidouble pow (double, double); 79425bb815Sopenharmony_cidouble sqrt (double); 80425bb815Sopenharmony_cidouble cbrt (double); 81425bb815Sopenharmony_ci 82425bb815Sopenharmony_ci/* Rounding and remainder functions. */ 83425bb815Sopenharmony_cidouble ceil (double); 84425bb815Sopenharmony_cidouble floor (double); 85425bb815Sopenharmony_ci 86425bb815Sopenharmony_ci/* Other functions. */ 87425bb815Sopenharmony_cidouble fabs (double); 88425bb815Sopenharmony_cidouble fmod (double, double); 89425bb815Sopenharmony_ci 90425bb815Sopenharmony_cidouble nextafter (double, double); 91425bb815Sopenharmony_ci 92425bb815Sopenharmony_ci#ifdef __cplusplus 93425bb815Sopenharmony_ci} 94425bb815Sopenharmony_ci#endif /* __cplusplus */ 95425bb815Sopenharmony_ci#endif /* !JERRY_LIBM_MATH_H */ 96