mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Apparently multi_convert_to_double_ex() didn't quite do what I
thought. Still need to handle numeric strings.
This commit is contained in:
parent
461e105069
commit
b9d68b8e9d
1 changed files with 4 additions and 3 deletions
|
@ -432,10 +432,11 @@ PHP_FUNCTION(pow)
|
||||||
double dval;
|
double dval;
|
||||||
zend_bool wantlong;
|
zend_bool wantlong;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zbase, &zexp) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z/", &zbase, &zexp) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: handle numeric strings. */
|
||||||
if ((Z_TYPE_P(zbase) != IS_LONG && Z_TYPE_P(zbase) != IS_DOUBLE) ||
|
if ((Z_TYPE_P(zbase) != IS_LONG && Z_TYPE_P(zbase) != IS_DOUBLE) ||
|
||||||
(Z_TYPE_P(zexp ) != IS_LONG && Z_TYPE_P(zexp ) != IS_DOUBLE)) {
|
(Z_TYPE_P(zexp ) != IS_LONG && Z_TYPE_P(zexp ) != IS_DOUBLE)) {
|
||||||
php_error(E_WARNING, "Invalid argument(s) passed to %s()", get_active_function_name(TSRMLS_C));
|
php_error(E_WARNING, "Invalid argument(s) passed to %s()", get_active_function_name(TSRMLS_C));
|
||||||
|
@ -446,8 +447,8 @@ PHP_FUNCTION(pow)
|
||||||
wantlong = Z_TYPE_P(zbase) == IS_LONG
|
wantlong = Z_TYPE_P(zbase) == IS_LONG
|
||||||
&& Z_TYPE_P(zexp ) == IS_LONG && Z_LVAL_P(zexp) >= 0;
|
&& Z_TYPE_P(zexp ) == IS_LONG && Z_LVAL_P(zexp) >= 0;
|
||||||
|
|
||||||
/* need to SEPERATE_ZVAL? */
|
convert_to_double(zbase);
|
||||||
multi_convert_to_double_ex(2,&zbase,&zexp);
|
convert_to_double(zexp);
|
||||||
|
|
||||||
/* go ahead and calculate things. */
|
/* go ahead and calculate things. */
|
||||||
dval = pow(Z_DVAL_P(zbase),Z_DVAL_P(zexp));
|
dval = pow(Z_DVAL_P(zbase),Z_DVAL_P(zexp));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue