Edit report at http://bugs.php.net/bug.php?id=53165&edit=1
ID: 53165 Updated by: der...@php.net Reported by: rt at interlogic dot com dot ua Summary: Expression calculation bug -Status: Open +Status: Bogus Type: Bug Package: Math related Operating System: Windows XP PHP Version: 5.2.14 Block user comment: N New Comment: Floating point values have a limited precision. Hence a value might not have the same string representation after any processing. That also includes writing a floating point value in your script and directly printing it without any mathematical operations. If you would like to know more about "floats" and what IEEE 754 is, read this: http://docs.sun.com/source/806-3568/ncg_goldberg.html Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2010-10-26 13:05:09] rt at interlogic dot com dot ua Description: ------------ It doesn't calculate expected value (220) in the given example (110 / (100 - 50) * 100). Test script: --------------- echo '<pre>'; echo 110 / (100 - 50) * 100; echo "\n"; echo var_export((110 / (100 - 50) * 100) == 220); echo "\n"; echo ceil(110 / (100 - 50) * 100); echo "\n"; echo sprintf('%.15f', 110 / (100 - 50) * 100); echo '</pre>'; ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53165&edit=1