Weird?!?!

From: Date: Wed, 31 Jul 2002 12:28:21 +0000
Subject: Weird?!?!
Groups: php.dev 
Request: Send a blank email to php-dev+get-86373@lists.php.net to get a copy of this message
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

« previous php.dev (#86373) next »