1 /*
2  * Copyright (c) 2019 Linaro Limited.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_MATH_H_
8 #define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_MATH_H_
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__)
15 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
16 #endif
17 
18 #if defined FLT_EVAL_METHOD
19 	#if FLT_EVAL_METHOD == 0
20 		typedef float  float_t;
21 		typedef double double_t;
22 	#elif FLT_EVAL_METHOD == 1
23 		typedef double float_t;
24 		typedef double double_t;
25 	#elif FLT_EVAL_METHOD == 2
26 		typedef long double float_t;
27 		typedef long double double_t;
28 	#else
29 		/* Implementation-defined.  Assume float_t and double_t have
30 		 * already been defined */
31 	#endif
32 #else
33 	typedef float  float_t;
34 	typedef double double_t;
35 #endif
36 
37 /* Useful constants.  */
38 #define MAXFLOAT    3.40282347e+38F
39 
40 #define M_E         2.7182818284590452354
41 #define M_LOG2E     1.4426950408889634074
42 #define M_LOG10E    0.43429448190325182765
43 #define M_LN2       0.693147180559945309417
44 #define M_LN10      2.30258509299404568402
45 #define M_PI        3.14159265358979323846
46 #define M_PI_2      1.57079632679489661923
47 #define M_PI_4      0.78539816339744830962
48 #define M_1_PI      0.31830988618379067154
49 #define M_2_PI      0.63661977236758134308
50 #define M_2_SQRTPI  1.12837916709551257390
51 #define M_SQRT2     1.41421356237309504880
52 #define M_SQRT1_2   0.70710678118654752440
53 
54 float sqrtf(float square);
55 double sqrt(double square);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_MATH_H_ */
62