1/*
2 +----------------------------------------------------------------------+
3 | PHP Version 5 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2015 The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Jim Winstead <jimw@php.net> |
16 | Stig Sæther Bakken <ssb@php.net> |
17 +----------------------------------------------------------------------+
18*/
19
20/* $Id$ */
21
22#ifndef PHP_MATH_H
23#define PHP_MATH_H
24
25PHPAPI char *_php_math_number_format(double, int, char, char);
26PHPAPI char *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t);
27PHPAPI char * _php_math_longtobase(zval *arg, int base);
28PHPAPI long _php_math_basetolong(zval *arg, int base);
29PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret);
30PHPAPI char * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC);
31
32PHP_FUNCTION(sin);
33PHP_FUNCTION(cos);
34PHP_FUNCTION(tan);
35PHP_FUNCTION(asin);
36PHP_FUNCTION(acos);
37PHP_FUNCTION(atan);
38PHP_FUNCTION(atan2);
39PHP_FUNCTION(pi);
40PHP_FUNCTION(exp);
41PHP_FUNCTION(log);
42PHP_FUNCTION(log10);
43PHP_FUNCTION(is_finite);
44PHP_FUNCTION(is_infinite);
45PHP_FUNCTION(is_nan);
46PHP_FUNCTION(pow);
47PHP_FUNCTION(sqrt);
48PHP_FUNCTION(srand);
49PHP_FUNCTION(rand);
50PHP_FUNCTION(getrandmax);
51PHP_FUNCTION(mt_srand);
52PHP_FUNCTION(mt_rand);
53PHP_FUNCTION(mt_getrandmax);
54PHP_FUNCTION(abs);
55PHP_FUNCTION(ceil);
56PHP_FUNCTION(floor);
57PHP_FUNCTION(round);
58PHP_FUNCTION(decbin);
59PHP_FUNCTION(dechex);
60PHP_FUNCTION(decoct);
61PHP_FUNCTION(bindec);
62PHP_FUNCTION(hexdec);
63PHP_FUNCTION(octdec);
64PHP_FUNCTION(base_convert);
65PHP_FUNCTION(number_format);
66PHP_FUNCTION(fmod);
67PHP_FUNCTION(deg2rad);
68PHP_FUNCTION(rad2deg);
69
70 /*
71 WARNING: these functions are expermental: they could change their names or
72 disappear in the next version of PHP!
73 */
74PHP_FUNCTION(hypot);
75PHP_FUNCTION(expm1);
76PHP_FUNCTION(log1p);
77
78PHP_FUNCTION(sinh);
79PHP_FUNCTION(cosh);
80PHP_FUNCTION(tanh);
81
82PHP_FUNCTION(asinh);
83PHP_FUNCTION(acosh);
84PHP_FUNCTION(atanh);
85
86#include <math.h>
87
88#ifndef M_E
89#define M_E 2.7182818284590452354 /* e */
90#endif
91
92#ifndef M_LOG2E
93#define M_LOG2E 1.4426950408889634074 /* log_2 e */
94#endif
95
96#ifndef M_LOG10E
97#define M_LOG10E 0.43429448190325182765 /* log_10 e */
98#endif
99
100#ifndef M_LN2
101#define M_LN2 0.69314718055994530942 /* log_e 2 */
102#endif
103
104#ifndef M_LN10
105#define M_LN10 2.30258509299404568402 /* log_e 10 */
106#endif
107
108#ifndef M_PI
109#define M_PI 3.14159265358979323846 /* pi */
110#endif
111
112#ifndef M_PI_2
113#define M_PI_2 1.57079632679489661923 /* pi/2 */
114#endif
115
116#ifndef M_PI_4
117#define M_PI_4 0.78539816339744830962 /* pi/4 */
118#endif
119
120#ifndef M_1_PI
121#define M_1_PI 0.31830988618379067154 /* 1/pi */
122#endif
123
124#ifndef M_2_PI
125#define M_2_PI 0.63661977236758134308 /* 2/pi */
126#endif
127
128#ifndef M_SQRTPI
129#define M_SQRTPI 1.77245385090551602729 /* sqrt(pi) */
130#endif
131
132#ifndef M_2_SQRTPI
133#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
134#endif
135
136#ifndef M_LNPI
137#define M_LNPI 1.14472988584940017414 /* ln(pi) */
138#endif
139
140#ifndef M_EULER
141#define M_EULER 0.57721566490153286061 /* Euler constant */
142#endif
143
144#ifndef M_SQRT2
145#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
146#endif
147
148#ifndef M_SQRT1_2
149#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
150#endif
151
152#ifndef M_SQRT3
153#define M_SQRT3 1.73205080756887729352 /* sqrt(3) */
154#endif
155
156/* Define rounding modes (all are round-to-nearest) */
157#ifndef PHP_ROUND_HALF_UP
158#define PHP_ROUND_HALF_UP 0x01 /* Arithmetic rounding, up == away from zero */
159#endif
160
161#ifndef PHP_ROUND_HALF_DOWN
162#define PHP_ROUND_HALF_DOWN 0x02 /* Down == towards zero */
163#endif
164
165#ifndef PHP_ROUND_HALF_EVEN
166#define PHP_ROUND_HALF_EVEN 0x03 /* Banker's rounding */
167#endif
168
169#ifndef PHP_ROUND_HALF_ODD
170#define PHP_ROUND_HALF_ODD 0x04
171#endif
172
173#endif /* PHP_MATH_H */
174