… not cover 64-bit range fully, floats might save the day. The trick is that PHP floats are in fact doubles, i.e… And PHP 5.2.2 on Windows produces yet another variant: s1=1125899906840000 s2=1125899906842625 As you can see float to string conversion is not portable across systems and PHP versions. So if you’re handling large numbers stored as float (especially…
Comment: PHP vs. BIGINT vs. float conversion caveat
… today on PHP vs. BIGINT vs. float conversion caveatHere’s a quick excerpt Sometimes you need to work with big numbers in PHP (gulp…-bit integers are in PHP. But if the numbers you use do not cover 64-bit range fully, floats might save the day. The trick is that PHP floats are in fact doubles, i.e…
Comment: PHP vs. BIGINT vs. float conversion caveat
… Blog wrote an interesting post today on Comment on PHP vs. BIGINT vs. float conversion caveat by Windows…Here’s a quick excerpt[…] MySQL Performance Blog wrote an interesting post today on PHP vs. BIGINT vs. float conversion caveatHere’s a quick excerpt Sometimes you need… [...]
Post: Handling big result sets
… NULL, `f11` int(11) default NULL, `f12` float default NULL, `f13` int(11) default NULL, …string and client has to do reverse conversion. This takes time. Furthemore string data … bit. So script with prepared statements: < ?php $mysqli = new mysqli(“localhost”, “root”, “”, “test”); /* check connection…
Comment: PHP vs. BIGINT vs. float conversion caveat
… made a typo. I explicitly mentioned conversion TO string, in bold. > in both cases float is expected to lose its precision No…-bit doubles (it’s a bit more trusted source than php.net/float by the way). Doubles have 52 bits allocated for… perfectly valid solution in some scenarios. It’s only the float to string conversion which suddenly, and unexpectedly, fails.
Comment: PHP vs. BIGINT vs. float conversion caveat
… different thing – conversion from string. First of all, I don’t see any strings there. I can see a float converted to… though PHP tries to handle this in a crossplatform way (because it uses its own float-to-string and string-to-float utilities…. Not enough for the author? — Oh, yeah, surely “designers of PHP 5 (released in 2004) type system were either not aware…
Comment: About Vadim Tkachenko
… sourcecode espacially that in reader.php. Well I understand that somewhere there is exponent to floating point number conversion. I would like to put this functionality off in reader.php but don’t know…
Comment: PHP vs. BIGINT vs. float conversion caveat
The problem with PHP (or its documentation) is intimate behavior details are not described and assumptions can be wrong. If conversion of floats to strings is not designed to be predictable it would be good to say it is platform and/or version dependent.

