ID: 27199 Updated by: [EMAIL PROTECTED] Reported By: ribarra at innox dot com dot mx -Status: Open +Status: Bogus Bug Type: *Math Functions Operating System: Linux Mandrake 9.2 PHP Version: 4.3.4 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. Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2004-02-10 00:33:18] ribarra at innox dot com dot mx Description: ------------ The following code should output exactly the same number in both echo cases but it doesn't. However, multiply the number by 1000 instead of the 100 on the first line and everything will work fine. Reproduce code: --------------- <?php $test = (642 + 0.56) * 100; echo $test . "\n"; $test = intval ($test); echo $test; ?> Expected result: ---------------- 64256 64256 Actual result: -------------- 64256 64255 Very weird, I have only seen it happen with this particular case. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27199&edit=1