ID: 43976 Updated by: [EMAIL PROTECTED] Reported By: gh-ush at gmx dot de -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Debian PHP Version: 5.2.5 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: ------------------------------------------------------------------------ [2008-01-29 21:39:57] gh-ush at gmx dot de Description: ------------ Problem with float Reproduce code: --------------- $a = 74.1; var_dump($a); echo "<hr>"; $a = $a * 100; var_dump($a); print "<hr>"; $a = (int)$a; var_dump($a); print "<hr>"; exit; Expected result: ---------------- float(74.1) --------------------- float(7410) --------------------- int(7409) Actual result: -------------- float(74.1) --------------------- float(7410) --------------------- int(7410) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43976&edit=1
