Back to index

php5  5.3.10
php_math.h
Go to the documentation of this file.
00001 /* 
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Jim Winstead <jimw@php.net>                                 |
00016    |          Stig Sæther Bakken <ssb@php.net>                            |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: php_math.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef PHP_MATH_H
00023 #define PHP_MATH_H
00024 
00025 PHPAPI char *_php_math_number_format(double, int, char , char);
00026 PHPAPI char * _php_math_longtobase(zval *arg, int base);
00027 PHPAPI long _php_math_basetolong(zval *arg, int base);
00028 PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret);
00029 PHPAPI char * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC);
00030 
00031 PHP_FUNCTION(sin);
00032 PHP_FUNCTION(cos);
00033 PHP_FUNCTION(tan);
00034 PHP_FUNCTION(asin);
00035 PHP_FUNCTION(acos);
00036 PHP_FUNCTION(atan);
00037 PHP_FUNCTION(atan2);
00038 PHP_FUNCTION(pi);
00039 PHP_FUNCTION(exp);
00040 PHP_FUNCTION(log);
00041 PHP_FUNCTION(log10);
00042 PHP_FUNCTION(is_finite);
00043 PHP_FUNCTION(is_infinite);
00044 PHP_FUNCTION(is_nan);
00045 PHP_FUNCTION(pow);
00046 PHP_FUNCTION(sqrt);
00047 PHP_FUNCTION(srand);
00048 PHP_FUNCTION(rand);
00049 PHP_FUNCTION(getrandmax);
00050 PHP_FUNCTION(mt_srand);
00051 PHP_FUNCTION(mt_rand);
00052 PHP_FUNCTION(mt_getrandmax);
00053 PHP_FUNCTION(abs);
00054 PHP_FUNCTION(ceil);
00055 PHP_FUNCTION(floor);
00056 PHP_FUNCTION(round);
00057 PHP_FUNCTION(decbin);
00058 PHP_FUNCTION(dechex);
00059 PHP_FUNCTION(decoct);
00060 PHP_FUNCTION(bindec);
00061 PHP_FUNCTION(hexdec);
00062 PHP_FUNCTION(octdec);
00063 PHP_FUNCTION(base_convert);
00064 PHP_FUNCTION(number_format);
00065 PHP_FUNCTION(fmod);
00066 PHP_FUNCTION(deg2rad);
00067 PHP_FUNCTION(rad2deg);
00068 
00069    /*
00070    WARNING: these functions are expermental: they could change their names or 
00071    disappear in the next version of PHP!
00072    */
00073 PHP_FUNCTION(hypot);
00074 PHP_FUNCTION(expm1);
00075 PHP_FUNCTION(log1p);
00076 
00077 PHP_FUNCTION(sinh);
00078 PHP_FUNCTION(cosh);
00079 PHP_FUNCTION(tanh);
00080 
00081 PHP_FUNCTION(asinh);
00082 PHP_FUNCTION(acosh);
00083 PHP_FUNCTION(atanh);
00084 
00085 #include <math.h>
00086 
00087 #ifndef M_E
00088 #define M_E            2.7182818284590452354   /* e */
00089 #endif
00090 
00091 #ifndef M_LOG2E
00092 #define M_LOG2E        1.4426950408889634074   /* log_2 e */
00093 #endif
00094 
00095 #ifndef M_LOG10E
00096 #define M_LOG10E       0.43429448190325182765  /* log_10 e */
00097 #endif
00098 
00099 #ifndef M_LN2
00100 #define M_LN2          0.69314718055994530942  /* log_e 2 */
00101 #endif
00102 
00103 #ifndef M_LN10
00104 #define M_LN10         2.30258509299404568402  /* log_e 10 */
00105 #endif
00106 
00107 #ifndef M_PI
00108 #define M_PI           3.14159265358979323846  /* pi */
00109 #endif
00110 
00111 #ifndef M_PI_2
00112 #define M_PI_2         1.57079632679489661923  /* pi/2 */
00113 #endif
00114 
00115 #ifndef M_PI_4
00116 #define M_PI_4         0.78539816339744830962  /* pi/4 */
00117 #endif
00118 
00119 #ifndef M_1_PI
00120 #define M_1_PI         0.31830988618379067154  /* 1/pi */
00121 #endif
00122 
00123 #ifndef M_2_PI
00124 #define M_2_PI         0.63661977236758134308  /* 2/pi */
00125 #endif
00126 
00127 #ifndef M_SQRTPI
00128 #define M_SQRTPI       1.77245385090551602729  /* sqrt(pi) */
00129 #endif
00130 
00131 #ifndef M_2_SQRTPI
00132 #define M_2_SQRTPI     1.12837916709551257390  /* 2/sqrt(pi) */
00133 #endif
00134 
00135 #ifndef M_LNPI
00136 #define M_LNPI         1.14472988584940017414  /* ln(pi) */
00137 #endif
00138 
00139 #ifndef M_EULER
00140 #define M_EULER        0.57721566490153286061 /* Euler constant */
00141 #endif
00142 
00143 #ifndef M_SQRT2
00144 #define M_SQRT2        1.41421356237309504880  /* sqrt(2) */
00145 #endif
00146 
00147 #ifndef M_SQRT1_2
00148 #define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2) */
00149 #endif
00150 
00151 #ifndef M_SQRT3
00152 #define M_SQRT3             1.73205080756887729352  /* sqrt(3) */
00153 #endif
00154 
00155 /* Define rounding modes (all are round-to-nearest) */
00156 #ifndef PHP_ROUND_HALF_UP
00157 #define PHP_ROUND_HALF_UP        0x01    /* Arithmetic rounding, up == away from zero */
00158 #endif
00159 
00160 #ifndef PHP_ROUND_HALF_DOWN
00161 #define PHP_ROUND_HALF_DOWN      0x02    /* Down == towards zero */
00162 #endif
00163 
00164 #ifndef PHP_ROUND_HALF_EVEN
00165 #define PHP_ROUND_HALF_EVEN      0x03    /* Banker's rounding */
00166 #endif
00167 
00168 #ifndef PHP_ROUND_HALF_ODD
00169 #define PHP_ROUND_HALF_ODD       0x04
00170 #endif
00171 
00172 #endif /* PHP_MATH_H */