#40916 [NEW]: var_dump is not the friend of float numbers

From: Date: Mon, 26 Mar 2007 08:02:26 +0000
Subject: #40916 [NEW]: var_dump is not the friend of float numbers
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110775@lists.php.net to get a copy of this message
From: cutmaster at fearlesss dot com Operating system: Linux PHP version: 5.2.1 PHP Bug Type: Arrays related Bug description: var_dump is not the friend of float numbers Description: ------------ Using float in arrays with var_dump returns rounded results, which is definitly not the stored numbers... And if you try an echo sprintf('%.0f',$value[0]) you'll get the good value... Too bad :( Reproduce code: --------------- $value = array((float)"3700368445139",(float)"37003684447031"); var_dump($value); Expected result: ---------------- array(2) { [0]=> float(3700368445139) [1]=> float(37003684447031) } Actual result: -------------- array(2) { [0]=> float(3700368445140) [1]=> float(37003684447000) } -- Edit bug report at http://bugs.php.net/?id=40916&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40916&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40916&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40916&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40916&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40916&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40916&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40916&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40916&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40916&r=support Expected behavior: http://bugs.php.net/fix.php?id=40916&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40916&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40916&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40916&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40916&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40916&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40916&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40916&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40916&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40916&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40916&r=mysqlcfg

« previous php.bugs (#110775) next »