ID: 33576 Updated by: [EMAIL PROTECTED] Reported By: rick at ninjafoo dot com -Status: Open +Status: Bogus Bug Type: Math related Operating System: Gentoo Linux PHP Version: 4.3.11 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: ------------------------------------------------------------------------ [2005-07-05 20:11:18] rick at ninjafoo dot com Description: ------------ 100* certain values is not the same as 10*10* the same value. The following code should produce no output. I see output. Reproduce code: --------------- <?php $value1 = 19.6*100; $value2 = 19.6*10*10; if ($value1 != $value2) { echo 'funny, i thaught 100x was exactly the same as 10x10x....<br>'; echo 'value1='.$value1.', value2='.$value2.','; } ?> Expected result: ---------------- I expect nothing to happen. Actual result: -------------- funny, i thaught 100x was exactly the same as 10x10x.... value1=1960, value2=1960, ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33576&edit=1
