Edit report at http://bugs.php.net/bug.php?id=54017&edit=1
ID: 54017 Updated by: paj...@php.net Reported by: davidmdvd at gmail dot com Summary: allocation error of float variable -Status: Open +Status: Bogus Type: Bug Package: *General Issues Operating System: Windows 7 64(bits) PHP Version: 5.3.5 Block user comment: N Private report: N 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://www.floating-point-gui.de/ Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2011-02-14 17:48:11] davidmdvd at gmail dot com Description: ------------ <?php $ar = array(); $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.425; $ar[] = 0.425; $ar[] = 0.425; if ( array_sum($ar)>=17 ) "It was to come." ?> Test script: --------------- <?php $ar = array(); $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.85; $ar[] = 0.425; $ar[] = 0.425; $ar[] = 0.425; if ( array_sum($ar)>=17 ) "It was to come." ?> Expected result: ---------------- It was to come. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54017&edit=1