4 ms·
Floating point numbers are a particular way to represent (and modestly compress) rational numbers. I'm against rational number libraries because they use non-po
by thechao 5y ago
Floating point numbers are a particular way to represent (and modestly compress) rational numbers. I'm against rational number libraries because they use non-power-of-2 denominators and are, thus, fundamentally less efficient with respect to the actual cost of calculation.
- ogogmad 5y ago> Floating point numbers are a particular way to represent (and modestly compress) rational numbers No no no no no no. Rational arithmetic satisfies (a+b)+c=a+(b+c); floating point arithmetic does not. Therefore floats are not a subset of rationals.
- thechao 5y agoRational arithmetic on a computer does not satisfy this property, either, for the exact same reason floating point does not: there is a finite amount of memory. Floating point embraces this edge-case in a rigorous way that none of the rational arithmetic libraries I've used have ever even attempted.
- klodolph 5y ago> Rational arithmetic satisfies (a+b)+c=a+(b+c); floating point arithmetic does not. Therefore floats are not a subset of rationals. This reasoning is not sound. The conclusion is only correct by accident. The reason floats are not a subset of the rationals is because floats distinguish positive and negative zero, and because floats represent non-finite values (NaN and infinity). The fact that floating-point operations are not commutative is a consequence of the fact that floating-point numbers are not a "subring" of the rational numbers, not a consequence of the fact that the floating-point numbers are not a subset of the rationals. You could easily take a subset of the floating-point numbers that is also a subset of the rationals, it would still not be associative (assuming it contains at least two different elements). Here is the concept you are looking for: https://en.wikipedia.org/wiki/Subring https://en.wikipedia.org/wiki/Subring
- deleted 5y ago[deleted]