Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42918 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54798 invoked from network); 4 Feb 2009 16:28:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2009 16:28:27 -0000 X-Host-Fingerprint: 195.212.29.92 blueice4n2.uk.ibm.com Received: from [195.212.29.92] ([195.212.29.92:22049] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/32-61634-A22C9894 for ; Wed, 04 Feb 2009 11:28:27 -0500 Message-ID: To: internals@lists.php.net Date: Wed, 04 Feb 2009 16:28:16 +0000 User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 195.212.29.92 Subject: casting doubles to ints From: ilewis@uk.ibm.com (Iain Lewis) Hello all, I wanted to suggest back porting the behaviour of the DVAL_TO_LVAL macro from zend_operators.h from 5.3 to 5.2, and wondered whether people thought this was a good idea or not? The reason I want to do this is that while writing some tests, I noticed that the behaviour of casting a float to an int is a bit counter-intuitive on 64bit platforms for PHP 5.2. It looks as though this has been fixed in 5.3, and it would seem like a good idea to put this change back to 5.2 as well. From a personal point of view, it would mean I could write one test that would work on both 5.2 and 5.3, but it also seems like a sensible change, as the current behaviour is non-obvious. The change would cause some current tests to break, but I am happy to do the work to fix those up. This is how a few expressions get evaluated at the moment. Changing the macro would make the 5.2 behaviour match 5.3 Expression 5.3 (RHEL5-64) 5.2 (RHEL5-64) (int) (PHP_INT_MAX) 9223372036854775807 9223372036854775807 (int) (PHP_INT_MAX + 1) 9223372036854775807 -9223372036854775808 (int) (PHP_INT_MAX + 1000) 9223372036854775807 -9223372036854775808 (int) (PHP_INT_MAX + 10000) 9223372036854775807 -9223372036854765568 Does this seem like a good change?