1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | https://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: Jim Winstead <jimw@php.net> | 14 | Stig Sæther Bakken <ssb@php.net> | 15 +----------------------------------------------------------------------+ 16 */ 17 18 #ifndef PHP_MATH_H 19 #define PHP_MATH_H 20 21 PHPAPI double _php_math_round(double value, int places, int mode); 22 PHPAPI zend_string *_php_math_number_format(double d, int dec, char dec_point, char thousand_sep); 23 PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, const char *dec_point, size_t dec_point_len, const char *thousand_sep, size_t thousand_sep_len); 24 PHPAPI zend_string *_php_math_number_format_long(zend_long num, zend_long dec, const char *dec_point, size_t dec_point_len, const char *thousand_sep, size_t thousand_sep_len); 25 PHPAPI zend_string * _php_math_longtobase(zend_long arg, int base); 26 PHPAPI zend_long _php_math_basetolong(zval *arg, int base); 27 PHPAPI void _php_math_basetozval(zend_string *str, int base, zval *ret); 28 PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base); 29 30 #include <math.h> 31 #include "php_math_round_mode.h" 32 33 #ifndef M_E 34 #define M_E 2.7182818284590452354 /* e */ 35 #endif 36 37 #ifndef M_LOG2E 38 #define M_LOG2E 1.4426950408889634074 /* log_2 e */ 39 #endif 40 41 #ifndef M_LOG10E 42 #define M_LOG10E 0.43429448190325182765 /* log_10 e */ 43 #endif 44 45 #ifndef M_LN2 46 #define M_LN2 0.69314718055994530942 /* log_e 2 */ 47 #endif 48 49 #ifndef M_LN10 50 #define M_LN10 2.30258509299404568402 /* log_e 10 */ 51 #endif 52 53 #ifndef M_PI 54 #define M_PI 3.14159265358979323846 /* pi */ 55 #endif 56 57 #ifndef M_PI_2 58 #define M_PI_2 1.57079632679489661923 /* pi/2 */ 59 #endif 60 61 #ifndef M_PI_4 62 #define M_PI_4 0.78539816339744830962 /* pi/4 */ 63 #endif 64 65 #ifndef M_1_PI 66 #define M_1_PI 0.31830988618379067154 /* 1/pi */ 67 #endif 68 69 #ifndef M_2_PI 70 #define M_2_PI 0.63661977236758134308 /* 2/pi */ 71 #endif 72 73 #ifndef M_SQRTPI 74 #define M_SQRTPI 1.77245385090551602729 /* sqrt(pi) */ 75 #endif 76 77 #ifndef M_2_SQRTPI 78 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ 79 #endif 80 81 #ifndef M_LNPI 82 #define M_LNPI 1.14472988584940017414 /* ln(pi) */ 83 #endif 84 85 #ifndef M_EULER 86 #define M_EULER 0.57721566490153286061 /* Euler constant */ 87 #endif 88 89 #ifndef M_SQRT2 90 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ 91 #endif 92 93 #ifndef M_SQRT1_2 94 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ 95 #endif 96 97 #ifndef M_SQRT3 98 #define M_SQRT3 1.73205080756887729352 /* sqrt(3) */ 99 #endif 100 101 #endif /* PHP_MATH_H */ 102