ID: 41632 User updated by: ppyupp at 126 dot com Reported By: ppyupp at 126 dot com Status: Bogus Bug Type: Unknown/Other Function Operating System: windows linux PHP Version: 4.4.7 New Comment:
i change the code,like this: <?php $t = 1000-182.41; $t = $t; $b = 817.59; var_dump( $t ); var_dump( $b ); var_dump( $t*100 ); var_dump( ceil( $t*100 ) ); if ( $t == $b ) echo '$t == $b'; else echo '$t != $b'; ?> result: ============= float(817.59) float(817.59) float(81759) float(81759) $t == $b ths result is i want,is true Previous Comments: ------------------------------------------------------------------------ [2007-06-08 07:00:54] [EMAIL PROTECTED] 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. . ------------------------------------------------------------------------ [2007-06-08 05:41:20] ppyupp at 126 dot com Description: ------------ i think is very bad for operation!! please run the code! Reproduce code: --------------- <?php $t = 1000-882.41; $t = $t; $b = 117.59; var_dump( $t ); // print 117.59 var_dump( $b ); // print 117.59 var_dump( $t*100 ); // print 11759 var_dump( ceil( $t*100 ) ); //print 11760 (error!!!! must be 11759) if ( $t == $b ) echo '$t == $b'; else echo '$t != $b'; ?> Expected result: ---------------- float(117.59) float(117.59) float(11759) float(11759) $t == $b Actual result: -------------- float(117.59) float(117.59) float(11759) float(11760) $t != $b ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41632&edit=1