Re: My rounding proposal: Ok for PHP 5.3?
| From: | Lukas Kahwe Smith | Date: | Thu, 30 Oct 2008 11:46:30 +0000 |
| Subject: | Re: My rounding proposal: Ok for PHP 5.3? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41571@lists.php.net to get a copy of this message | ||
Hi,
Scott said he could apply the patch for you. And he is sitting right in front of me ..
regards,
Lukas
On 28.10.2008, at 18:28, Christian Seiler wrote:
Hi,Lukas Kahwe Smith mls@pooteeweet.orgSounds to me like you have done your homework and are committed to maintaining this. Codewise I will leave the decision to Johannes however.As Johannes has given his OK, I've created two patches (one for PHP 5.3 and one for HEAD): http://www.christian-seiler.de/temp/php/2008-10-28-fpu/php-float-precision-5.3.patch http://www.christian-seiler.de/temp/php/2008-10-28-fpu/php-float-precision-6.patch (Both are basically identical) I've tested them with the current PHP 5.3 branch under Linux and Windows (gcc) and with current PHP 5.3 under Windows (MSVC8, i.e. 2005) The patch does the following: * New zend_float.h which defines the following macros:ZEND_FLOAT_DECLARE() - Declare necessary helper vars ZEND_FLOAT_ENSURE() - Ensure double precision ZEND_FLOAT_RESTORE() - Restore previous precision ZEND_FLOAT_RETURN(val) - Return a double and restore prev. prec.(They are an alias to corresponding the XPFPA macros from my header file) * Added my configure checks to acinclude.m4. * Use them in zend_strtod.c and zend_operators.c in order to ensure that the precision used for calculations and string-to-float conversions is always double precision. * Added Zend/tests/float_prec_001.phpt which makes sure that both calculations and string-to-float logic use double precision. [This will also detect misbehaving platforms.] Please feel free to change any comments wrt. where this logic is from and/or whitespace formatting in the files. I'd appreciate it if you could commit this patch in the next days so I can commit my patch for round() that relies on the above. Regards, Christian