diff options
Diffstat (limited to 'ext/standard/math.c')
-rw-r--r-- | ext/standard/math.c | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c index 9e98fd35ff..06723216c6 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -382,9 +382,15 @@ PHP_FUNCTION(sin) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(sin(num)); } /* }}} */ @@ -395,9 +401,15 @@ PHP_FUNCTION(cos) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(cos(num)); } /* }}} */ @@ -408,9 +420,15 @@ PHP_FUNCTION(tan) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(tan(num)); } /* }}} */ @@ -421,9 +439,15 @@ PHP_FUNCTION(asin) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(asin(num)); } /* }}} */ @@ -434,9 +458,15 @@ PHP_FUNCTION(acos) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(acos(num)); } /* }}} */ @@ -447,9 +477,15 @@ PHP_FUNCTION(atan) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(atan(num)); } /* }}} */ @@ -460,9 +496,16 @@ PHP_FUNCTION(atan2) { double num1, num2; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_DOUBLE(num1) + Z_PARAM_DOUBLE(num2) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(atan2(num1, num2)); } /* }}} */ @@ -473,9 +516,15 @@ PHP_FUNCTION(sinh) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(sinh(num)); } /* }}} */ @@ -486,9 +535,15 @@ PHP_FUNCTION(cosh) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(cosh(num)); } /* }}} */ @@ -499,9 +554,15 @@ PHP_FUNCTION(tanh) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(tanh(num)); } /* }}} */ @@ -512,9 +573,15 @@ PHP_FUNCTION(asinh) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(php_asinh(num)); } /* }}} */ @@ -525,9 +592,15 @@ PHP_FUNCTION(acosh) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(php_acosh(num)); } /* }}} */ @@ -538,9 +611,15 @@ PHP_FUNCTION(atanh) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(php_atanh(num)); } /* }}} */ @@ -559,9 +638,15 @@ PHP_FUNCTION(is_finite) { double dval; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(dval) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_BOOL(zend_finite(dval)); } /* }}} */ @@ -572,9 +657,15 @@ PHP_FUNCTION(is_infinite) { double dval; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(dval) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_BOOL(zend_isinf(dval)); } /* }}} */ @@ -585,9 +676,15 @@ PHP_FUNCTION(is_nan) { double dval; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &dval) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(dval) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_BOOL(zend_isnan(dval)); } /* }}} */ @@ -612,9 +709,15 @@ PHP_FUNCTION(exp) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE(exp(num)); } @@ -630,9 +733,16 @@ PHP_FUNCTION(expm1) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif + RETURN_DOUBLE(php_expm1(num)); } /* }}} */ @@ -647,9 +757,16 @@ PHP_FUNCTION(log1p) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif + RETURN_DOUBLE(php_log1p(num)); } /* }}} */ @@ -660,9 +777,18 @@ PHP_FUNCTION(log) { double num, base = 0; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &num, &base) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_DOUBLE(num) + Z_PARAM_OPTIONAL + Z_PARAM_DOUBLE(base) + ZEND_PARSE_PARAMETERS_END(); +#endif + if (ZEND_NUM_ARGS() == 1) { RETURN_DOUBLE(log(num)); } @@ -684,9 +810,16 @@ PHP_FUNCTION(log10) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif + RETURN_DOUBLE(log10(num)); } /* }}} */ @@ -697,9 +830,16 @@ PHP_FUNCTION(sqrt) { double num; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(num) + ZEND_PARSE_PARAMETERS_END(); +#endif + RETURN_DOUBLE(sqrt(num)); } /* }}} */ @@ -710,9 +850,17 @@ PHP_FUNCTION(hypot) { double num1, num2; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_DOUBLE(num1) + Z_PARAM_DOUBLE(num2) + ZEND_PARSE_PARAMETERS_END(); +#endif + #if HAVE_HYPOT RETURN_DOUBLE(hypot(num1, num2)); #elif defined(_MSC_VER) @@ -729,9 +877,15 @@ PHP_FUNCTION(deg2rad) { double deg; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(deg) + ZEND_PARSE_PARAMETERS_END(); +#endif RETURN_DOUBLE((deg / 180.0) * M_PI); } /* }}} */ @@ -742,9 +896,16 @@ PHP_FUNCTION(rad2deg) { double rad; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &rad) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_DOUBLE(rad) + ZEND_PARSE_PARAMETERS_END(); +#endif + RETURN_DOUBLE((rad / M_PI) * 180); } /* }}} */ @@ -1182,9 +1343,19 @@ PHP_FUNCTION(number_format) char thousand_sep_chr = ',', dec_point_chr = '.'; int thousand_sep_len = 0, dec_point_len = 0; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_DOUBLE(num) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(dec) + Z_PARAM_STRING_EX(dec_point, dec_point_len, 1, 0) + Z_PARAM_STRING_EX(thousand_sep, thousand_sep_len, 1, 0) + ZEND_PARSE_PARAMETERS_END(); +#endif switch(ZEND_NUM_ARGS()) { case 1: @@ -1220,9 +1391,17 @@ PHP_FUNCTION(fmod) { double num1, num2; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &num1, &num2) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_DOUBLE(num1) + Z_PARAM_DOUBLE(num2) + ZEND_PARSE_PARAMETERS_END(); +#endif + RETURN_DOUBLE(fmod(num1, num2)); } /* }}} */ |