Re:Types versus sets in math and programming languages
by alisonkisk on Sunday July 25, 2021 @07:04PM
(#27953764)
> You obviously can't have the entire rationals, because your computer's memory is finite.
This doesn't matter, because our programs and data are finite. Bignum (which is plain old Integer in Haskell) is unbounded, but commonm
Re:Types versus sets in math and programming languages
by marcosdumay on Tuesday July 27, 2021 @12:07PM
(#27974066)
The memory size does not matter. For any finite size, you will get a closer approximation of the rationals from floating point than by a ratio of integers.
The difference ratio only gets bigger when you add more memory.
Thus, if you won't work with exact numbers, the best choice to represent rationals is to place all bits you can at the mantissa of a single side, and just store the order of magnitude of the other side. And, for simplicity you want the mantissa on the numerator side. What is basically a floating point number.
Things are very different if you will work with exact numbers.