3 ms·
Floats cannot be "fixed" because they are not broken. Floats are an extremely limited subset of the general rationals, and the general rationals are an extremel
by dreamcompiler 3y ago
Floats cannot be "fixed" because they are not broken. Floats are an extremely limited subset of the general rationals, and the general rationals are an extremely limited subset of the general reals.
It's theoretically impossible to compute with the general reals. Full stop.
It's theoretically possible to compute with the general rationals (Common Lisp for example lets you do so) but it's often impractical because you can easily end up running out of memory and/or time for the computation to complete.
It's practical to compute with floats because you can guarantee hard limits on memory usage and time. You just have to live with the fact that you can't represent the vast majority of real numbers and you lose associative arithmetic.
There are various other, weirder, computational number systems out there but the tradeoffs don't go away; they just move around.
- jcranmer 3y ago> It's theoretically impossible to compute with the general reals. Full stop. You could limit yourself to the computable numbers. Although you do have an issue determining equality on general computable numbers... But yeah, I would agree that floating-point is generally the best compromise out there for a general-purpose computational approximation to real numbers.
- deleted 3y ago[deleted]
- constantcrying 3y ago>It's theoretically impossible to compute with the general reals. Full stop. While that is true. It is possible to make mathematical true statememts about results of real number arithmetic on a computer. >you lose associative arithmetic. People like to complain about this, but it is a mathematical consequence of the reuirements. You can not fix that problem.