diff options
author | Zeev Suraski <zeev@php.net> | 1999-04-23 13:25:33 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-04-23 13:25:33 +0000 |
commit | b2c5ef42d34d4d071d73ebd53044c8f77f1ac931 (patch) | |
tree | d2357c17500d3d542ac8044ac24f3fd674301981 /Zend/zend_operators.c | |
parent | bce60f0fe64985568e7d6151ee34ba11a44b8023 (diff) | |
download | php-git-b2c5ef42d34d4d071d73ebd53044c8f77f1ac931.tar.gz |
Arithmetics bug fix
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r-- | Zend/zend_operators.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 242afc85b6..fedddb5f65 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -437,10 +437,10 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2) } if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->type = IS_DOUBLE; result->value.dval = (op1->type == IS_LONG ? (((double) op1->value.lval) + op2->value.dval) : (op1->value.dval + ((double) op2->value.lval))); + result->type = IS_DOUBLE; return SUCCESS; } if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { @@ -474,10 +474,10 @@ ZEND_API int sub_function(zval *result, zval *op1, zval *op2) } if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->type = IS_DOUBLE; result->value.dval = (op1->type == IS_LONG ? (((double) op1->value.lval) - op2->value.dval) : (op1->value.dval - ((double) op2->value.lval))); + result->type = IS_DOUBLE; return SUCCESS; } if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { @@ -511,10 +511,10 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2) } if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->type = IS_DOUBLE; result->value.dval = (op1->type == IS_LONG ? (((double) op1->value.lval) * op2->value.dval) : (op1->value.dval * ((double) op2->value.lval))); + result->type = IS_DOUBLE; return SUCCESS; } if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { @@ -550,10 +550,10 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2) } if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->type = IS_DOUBLE; result->value.dval = (op1->type == IS_LONG ? (((double) op1->value.lval) / op2->value.dval) : (op1->value.dval / ((double) op2->value.lval))); + result->type = IS_DOUBLE; return SUCCESS; } if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { @@ -895,8 +895,8 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2) } if ((op1->type == IS_DOUBLE || op1->type == IS_LONG) && (op2->type == IS_DOUBLE || op2->type == IS_LONG)) { - result->type = IS_DOUBLE; result->value.dval = (op1->type == IS_LONG ? (double) op1->value.lval : op1->value.dval) - (op2->type == IS_LONG ? (double) op2->value.lval : op2->value.dval); + result->type = IS_DOUBLE; return SUCCESS; } if ((op1->type==IS_ARRAY || op1->type==IS_OBJECT) |