Edit report at http://bugs.php.net/bug.php?id=52285&edit=1
ID: 52285 Updated by: ahar...@php.net Reported by: paulgao at yeah dot net Summary: serialize float number to loss precision~ -Status: Open +Status: Bogus Type: Bug Package: Variables related Operating System: irrelevant PHP Version: Irrelevant 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: ------------------------------------------------------------------------ [2010-07-08 11:34:01] paulgao at yeah dot net Description: ------------ serialize float number to loss precision. Test script: --------------- php -r 'var_dump(serialize(0.23));' Expected result: ---------------- string(7) "d:0.23;" Actual result: -------------- string(60) "d:0.2300000000000000099920072216264088638126850128173828125;" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52285&edit=1