ID: 24365 Comment by: marcot at tabini dot ca Reported By: jump at worldakt dot com Status: Open Bug Type: Zend Engine 2 problem Operating System: Linux PHP Version: 4.3.2 New Comment:
This is not really a bug. It's due to normal fluctuations in the way floating-point numbers are handled by the C libraries. Here's another example of this behaviour: http://bugs.php.net/bug.php?id=22333 You may also want to check out this bit on IEEE representation of floating-point number to understand why some numbers cannot be represented: http://www.psc.edu/general/software/packages/ieee/ieee.html Previous Comments: ------------------------------------------------------------------------ [2003-06-27 13:22:54] jump at worldakt dot com Description: ------------ It seems that when I soustract something (float) it returns a wrong result. Reproduce code: --------------- <?php echo 290.34 - (142.00 + 148.34); ?> -5.68434188608E-14 <?php echo 142.00 + 148.34; ?> 290.34 <?php echo 290.34 - 290.34; ?> 0 Expected result: ---------------- <?php echo 290.34 - (142.00 + 148.34); ?> 0 Actual result: -------------- <?php echo 290.34 - (142.00 + 148.34); ?> -5.68434188608E-14 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24365&edit=1