Re: Int to float precision loss in 64bit environment
Hi Ralph:
On Wed, Jan 13, 2010 at 06:30:04PM -0600, Ralph Schindler wrote:
> In talking with Stas, it seems that since PHP_INT_MAX+1 is pushed into a
> (float) and since float values are stuffed into 52bit mantissa / 11 bits
> for exponents, we are loosing some precision. That lost precisions is
> causing the above to fail in one platform, and work in another.
>
> Is this noted somewhere? Is there a workaround? Or, is this something
> that can be fixed for 64 bit platforms (somehow)?
It's not really documented, that I've seen. I'll put this on my todo
list.
There was a discussion about this in March/April of last year. In short,
it's not easily fixable. Christian Seiler's post on 2009-04-07 is very
interesting. The MARC archive split the thread in two:
http://marc.info/?t=123704116800002&r=1&w=2
http://marc.info/?t=123865732900002&r=1&w=2
I imagine the workarounds are the BC Math and GMP functions.
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
Thread (2 messages)