ID: 31018 Updated by: [EMAIL PROTECTED] Reported By: Fox235 at yandex dot ru -Status: Feedback +Status: Bogus Bug Type: *Programming Data Structures Operating System: Linux PHP Version: 4.3.9 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-12-08 12:23:47] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2004-12-08 12:02:30] Fox235 at yandex dot ru Description: ------------ not 1!But it's must = 1 Reproduce code: --------------- $a=split(';' , $Ver); rsort($a); print_r($a); $S = array_sum($a); $f=floatval($S); if ($f == 1) { echo "Yes, it's 1"; } else { echo "<br>Not, it's not 1";} ?> Expected result: ---------------- Array ( [0] => 0.5 [1] => 0.2 [2] => 0.1 [3] => 0.1 [4] => 0.1 ) Yes, it's 1 Actual result: -------------- Array ( [0] => 0.5 [1] => 0.2 [2] => 0.1 [3] => 0.1 [4] => 0.1 ) Not, it's not 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31018&edit=1