Re:9999999999999999.0 – 9999999999999998.0
by coddingtonbear on Saturday January 05, 2019 @01:15PM
(#18833187)
Is that really true? In my experience, 99.9% of the time I don't need an exact number; the vanishingly few times when I have such a need (almost entirely calculations involving currency), using a fixed point representation is simple enough.
Re:9999999999999999.0 – 9999999999999998.0
by dkarl on Saturday January 05, 2019 @05:54PM
(#18834847)
People do different kinds of work, so there are programmers who experience it both ways, 99% of the time floats are good solution or 99% of the time floats are an incorrect solution. Because of history and language support, classes and other resources for learning to program teach you to use floating-point numbers and don't bother with alternatives. As a result you have a lot of programmers who default to treating every number with a dot in it as floating point number, and they get burned by it, and instead of realizing it's just a gap in their education that they can correct, they treat overuse of floats as a mistaken industry-wide consensus that needs to be overturned.
Re:9999999999999999.0 – 9999999999999998.0
by zokier on Saturday January 05, 2019 @06:07PM
(#18834929)
I think there is argument to be made for high-level languages defaulting for arbitrary precision math ("make it correct first, fast second"). But considering that we are still fumbling around with fixed-width integers and that is much simpler domain after all, I don't hold my breath on "solving" the problem of reals any time soon.
Re:9999999999999999.0 – 9999999999999998.0
by Gibbon1 on Sunday January 06, 2019 @04:58PM
(#18840994)
That's exactly my point, why is the default a lossy format? And consider the distinction between variables and calculations. Formats like IEEE754 are designed for performing fast high accuracy transformations on matrices. I have no complaints about that. But the default arbitrary number format should be able to store exact integers and ratio's.
Re:9999999999999999.0 – 9999999999999998.0
by Gibbon1 on Saturday January 05, 2019 @02:20PM
(#18833621)
You don't need an exact number but customer data is universally decimal. Soon as you blindly convert that to IEE754 everything is now broken.
Re:9999999999999999.0 – 9999999999999998.0
by coddingtonbear on Saturday January 05, 2019 @03:44PM
(#18834129)
Is it really, though? I'm honestly struggling to think of a non-currency situation in which fractional customer data necessarily be handled as a decimal value -- and, honestly, even if the availability heuristic might make them seem more common than they are, I'd be astonished if even a single percent of general calculations programmers collectively ask computers to perform are involving currency. Most real-life situations just don't even inherently _have_ that kind of precision, let alone need it. Seriously, I can't think of a time when I've needed to store a coordinate or a person's height as a decimal value to prevent something from being broken.
Re:9999999999999999.0 – 9999999999999998.0
by tedunangst on Saturday January 05, 2019 @08:32PM
(#18835734)
My 5/8s wrench disagrees. Happens to store quite nicely in a float, however.
You answered your question. 99% of the time being exact is a requirement and calculation speed is utterly unimportant, thus using IEEE 754 results in programs that are fundamentally broken.