Re: svn: /php/php-src/trunk/Zend/ zend_operators.c
| From: | Pierre Joye | Date: | Sun, 22 Aug 2010 11:33:22 +0000 |
| Subject: | Re: svn: /php/php-src/trunk/Zend/ zend_operators.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-63349@lists.php.net to get a copy of this message | ||
hi,
test case? Thanks :)
On Sun, Aug 22, 2010 at 10:01 AM, Scott MacVicar <scottmac@php.net> wrote:
> scottmac Sun, 22 Aug 2010 08:01:34 +0000
>
> Revision:
> http://svn.php.net/viewvc?view=revision&revision=302629
>
> Log:
> Fix a bug where two doubles are equal but the maths operation makes it appear false.
>
> Best example with INF where equals and identical produce different results.
>
> <?php
> var_dump(INF==INF);
> var_dump(INF===INF);
>
> Changed paths:
> U php/php-src/trunk/Zend/zend_operators.c
>
> Modified: php/php-src/trunk/Zend/zend_operators.c
> ===================================================================
> --- php/php-src/trunk/Zend/zend_operators.c 2010-08-22 00:59:41 UTC (rev 302628)
> +++ php/php-src/trunk/Zend/zend_operators.c 2010-08-22 08:01:34 UTC (rev 302629)
> @@ -1410,8 +1410,12 @@
> return SUCCESS;
>
> case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
> - Z_DVAL_P(result) = Z_DVAL_P(op1) -
> Z_DVAL_P(op2);
> - ZVAL_LONG(result,
> ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
> + if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) {
> + ZVAL_LONG(result, 0);
> + } else {
> + Z_DVAL_P(result) = Z_DVAL_P(op1) -
> Z_DVAL_P(op2);
> + ZVAL_LONG(result,
> ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
> + }
> return SUCCESS;
>
> case TYPE_PAIR(IS_ARRAY, IS_ARRAY):
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org