Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"Floating points are the worst method of representing rational numbers, except for all the others." —Winston Churchill probably


Nah, arbitrary precision rationals are much better if you actually only need to represent rationals. And frankly even for reals, decimal types are better for most use cases.


For "most use cases" (by far) of arbitrary fractional numbers, floats are significantly better than integer based representations, which is why they are pervasive. For certain niche uses (such as some kinds of money accounting calculations) alternative integer-based representations have some advantages, and those who need them use them where appropriate.


Disagree. IEEE floats see a disproportionate amount of use because most programming languages make them much easier to use than more appropriate representations, and people (understandably) use the representation the language guides them to rather than seriously analysing and considering the options.


Arbitrary precision sounds good but my registers have 64 bits and it takes several instructions to load arbitrary bit slices from memory.

It's a lot more performant to use the equivalent of scientific notation.


Sure, but the vast majority of the time that performance difference doesn't matter, or at least isn't worth the large sacrifices in usability and consistency that it costs.


The vast majority of the time floats are a significantly more convenient representation, with more than enough precision for the job, and alternatives are so slow that they are somewhere between painful and literally impossible to use. Arbitrary precision computation grows exponentially more expensive as you perform arithmetic operations on it, and people routinely apply transcendental functions whose results cannot be represented using a finite number of binary digits.

If you are finding otherwise in your personal work, you are likely in some niche field sheltered far from the bulk of numerical computing applications.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: