#include "php.h"
#include "php_math.h"
#include "zend_bitset.h"
#include "zend_enum.h"
#include "zend_exceptions.h"
#include "zend_multiply.h"
#include "zend_portability.h"
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include "basic_functions.h"
Go to the source code of this file.
|
PHPAPI double | _php_math_round (double value, int places, int mode) |
|
| PHP_FUNCTION (abs) |
|
| PHP_FUNCTION (ceil) |
|
| PHP_FUNCTION (floor) |
|
PHPAPI int | php_math_round_mode_from_enum (zend_object *mode) |
|
| PHP_FUNCTION (round) |
|
| PHP_FUNCTION (sin) |
|
| PHP_FUNCTION (cos) |
|
| PHP_FUNCTION (tan) |
|
| PHP_FUNCTION (asin) |
|
| PHP_FUNCTION (acos) |
|
| PHP_FUNCTION (atan) |
|
| PHP_FUNCTION (atan2) |
|
| PHP_FUNCTION (sinh) |
|
| PHP_FUNCTION (cosh) |
|
| PHP_FUNCTION (tanh) |
|
| PHP_FUNCTION (asinh) |
|
| PHP_FUNCTION (acosh) |
|
| PHP_FUNCTION (atanh) |
|
| PHP_FUNCTION (pi) |
|
| PHP_FUNCTION (is_finite) |
|
| PHP_FUNCTION (is_infinite) |
|
| PHP_FUNCTION (is_nan) |
|
| PHP_FUNCTION (pow) |
|
| PHP_FUNCTION (exp) |
|
| PHP_FUNCTION (expm1) |
|
| PHP_FUNCTION (log1p) |
|
| PHP_FUNCTION (log) |
|
| PHP_FUNCTION (log10) |
|
| PHP_FUNCTION (sqrt) |
|
| PHP_FUNCTION (hypot) |
|
| PHP_FUNCTION (deg2rad) |
|
| PHP_FUNCTION (rad2deg) |
|
PHPAPI zend_long | _php_math_basetolong (zval *arg, int base) |
|
PHPAPI void | _php_math_basetozval (zend_string *str, int base, zval *ret) |
|
PHPAPI zend_string * | _php_math_longtobase (zend_long arg, int base) |
|
PHPAPI zend_string * | _php_math_zvaltobase (zval *arg, int base) |
|
| PHP_FUNCTION (bindec) |
|
| PHP_FUNCTION (hexdec) |
|
| PHP_FUNCTION (octdec) |
|
| PHP_FUNCTION (decbin) |
|
| PHP_FUNCTION (decoct) |
|
| PHP_FUNCTION (dechex) |
|
| ZEND_FRAMELESS_FUNCTION (dechex, 1) |
|
| PHP_FUNCTION (base_convert) |
|
PHPAPI zend_string * | _php_math_number_format (double d, int dec, char dec_point, char thousand_sep) |
|
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) |
|
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) |
|
| PHP_FUNCTION (number_format) |
|
| PHP_FUNCTION (fmod) |
|
| PHP_FUNCTION (fdiv) |
|
| PHP_FUNCTION (fpow) |
|
| PHP_FUNCTION (intdiv) |
|
◆ _php_math_basetolong()
◆ _php_math_basetozval()
◆ _php_math_longtobase()
◆ _php_math_number_format()
PHPAPI zend_string * _php_math_number_format |
( |
double | d, |
|
|
int | dec, |
|
|
char | dec_point, |
|
|
char | thousand_sep ) |
◆ _php_math_number_format_ex()
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 ) |
◆ _php_math_number_format_long()
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 ) |
◆ _php_math_round()
PHPAPI double _php_math_round |
( |
double | value, |
|
|
int | places, |
|
|
int | mode ) |
When extracting the integer part, the result may be incorrect as a decimal number due to floating point errors. e.g. 0.285 * 10000000000 => 2849999999.9999995 floor(0.285 * 10000000000) => 2849999999
Add 1 to the absolute value of the value adjusted by floor or ceil, use the exponent to return it to its original precision, and compare it with value. If it is equal to value, it is assumed that the absolute value is 1 smaller due to error and will be corrected. e.g. 0.285 * 10000000000 => 2849999999.9999995 floor(0.285 * 10000000000) => 2849999999 (tmp_value) tmp_value2 = 2849999999 + 1 => 2850000000 2850000000 / 10000000000 == 0.285 => true tmp_value = tmp_value2
Definition at line 167 of file math.c.
◆ _php_math_zvaltobase()
◆ PHP_FUNCTION() [1/43]
◆ PHP_FUNCTION() [2/43]
◆ PHP_FUNCTION() [3/43]
◆ PHP_FUNCTION() [4/43]
◆ PHP_FUNCTION() [5/43]
◆ PHP_FUNCTION() [6/43]
◆ PHP_FUNCTION() [7/43]
◆ PHP_FUNCTION() [8/43]
◆ PHP_FUNCTION() [9/43]
◆ PHP_FUNCTION() [10/43]
◆ PHP_FUNCTION() [11/43]
◆ PHP_FUNCTION() [12/43]
◆ PHP_FUNCTION() [13/43]
◆ PHP_FUNCTION() [14/43]
◆ PHP_FUNCTION() [15/43]
◆ PHP_FUNCTION() [16/43]
◆ PHP_FUNCTION() [17/43]
◆ PHP_FUNCTION() [18/43]
◆ PHP_FUNCTION() [19/43]
◆ PHP_FUNCTION() [20/43]
◆ PHP_FUNCTION() [21/43]
◆ PHP_FUNCTION() [22/43]
◆ PHP_FUNCTION() [23/43]
◆ PHP_FUNCTION() [24/43]
◆ PHP_FUNCTION() [25/43]
◆ PHP_FUNCTION() [26/43]
◆ PHP_FUNCTION() [27/43]
◆ PHP_FUNCTION() [28/43]
◆ PHP_FUNCTION() [29/43]
◆ PHP_FUNCTION() [30/43]
◆ PHP_FUNCTION() [31/43]
◆ PHP_FUNCTION() [32/43]
◆ PHP_FUNCTION() [33/43]
◆ PHP_FUNCTION() [34/43]
◆ PHP_FUNCTION() [35/43]
◆ PHP_FUNCTION() [36/43]
◆ PHP_FUNCTION() [37/43]
◆ PHP_FUNCTION() [38/43]
◆ PHP_FUNCTION() [39/43]
◆ PHP_FUNCTION() [40/43]
◆ PHP_FUNCTION() [41/43]
◆ PHP_FUNCTION() [42/43]
◆ PHP_FUNCTION() [43/43]
◆ php_math_round_mode_from_enum()
◆ ZEND_FRAMELESS_FUNCTION()
ZEND_FRAMELESS_FUNCTION |
( |
dechex | , |
|
|
1 | ) |
◆ rounding_mode_ce