Hi,

Could someone tell me why the Zend Engine calculates every multiplication
2 times???

zend_operators.c:

ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
...
        if (op1->type == IS_LONG && op2->type == IS_LONG) {
                double dval = (double) op1->value.lval * (double) op2->value.lval;

                if ((dval > (double) LONG_MAX) || (dval < (double) LONG_MIN)) {
                        result->value.dval = dval;
                        result->type = IS_DOUBLE;
                } else {
                        result->value.lval = op1->value.lval * op2->value.lval;
                        result->type = IS_LONG;
                }
                return SUCCESS;

...

should that be replaced with:

result->value.lval = (long)dval;

instead of calculating the multiplication again???


Stefan Esser


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to