Ilia Alshanetsky wrote:
Could you not treat a very large integer as a double? We do that in a few
areas of the code already.
Treating it as a double is exactly what json_decode() *currently* does,
and it's the problem I'm trying to work around by leaving it in string form.
When a large integer is cast as a double, it looses precision, and
1234567890123456789 might suddenly look like (for example)
php -r 'var_dump((float)"1234567890123456789"
float(1.2345678901235E+18)
We've now lost the lowest four digits of this number. For a
sum/average/difference type number, that imprecision may be acceptable,
but for a specific ID used in (for example) a database, it means that
9,999 of every 10,000 records all wind up correlating to the same
incorrect ID.
-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php