Hey George,
My point is: I'm not against improving accuracy of floating point arithmetic in PHP (although it could lead to some weird compatibility problems with older version) but I wouldn't advise people who really, really have to rely on their numbers to be correct to use floats anyway.
George Whiffen wrote: > Exactly my point. When coding php you need floating point you can > trust or it is useless. As I said, bc is probably the best currently
You can never trust floating point if you need both big numbers and precision at the same time. Floating point is always a trade off between the two.
> If I'm wrong, and it's really only bc that can be trusted to add 0.1 > and 0.1, then shouldn't we be using that internally, rather than > pretending to have a useable fp decimal arithmetic?
Floating point (even the current PHP implementation) is fine if you're happy enough with approximations which is the case 99% of the time.
> P.S. I'm interested that you have money numbers so big that 15 digits > are not enough. It can't be gross world income which still isn't up
I store cent values as integer strings and I possibly have to deal with values bigger than 214 million bucks (where PHP starts to convert ints to float) so I decided to go for BC Math. I didn't even care to check what the range/precision limits of floats are as I wanted something absolutely predictable, no matter what numbers are put into the system by our customers.
Just because you're paranoid doesn't mean they're not after you :-) - Chris
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php