News for hackers. Stuff that matters.
Re:Is Cobol holding you hostage with Math? by boomlinde on Sunday July 29, 2018 @06:08AM (#17637328)
Floating point numbers are all rational. Given that rational numbers are a countable subset of real numbers, I think it's inaccurate to say that floats are somehow "emulated reals" as opposed to rationals. The radix of a floating point number relates to the quotient of a rational number. For example in decimal floating point significand-base-exponent form, 1.23 is 123 * 10^-2 or 123/100.
Re:Is Cobol holding you hostage with Math? by m314 on Sunday July 29, 2018 @10:22AM (#17638259)
The operations on floating point numbers do not behave like rational numbers. Floating point 1.0/3.0 is not equal to the rational 1/3. It's the same up to a margin of error, yes, but that's where the emulation part comes in. It would also be fair to say that floating point numbers are "emulated rationals".
Re:Is Cobol holding you hostage with Math? by rhaps0dy on Monday July 30, 2018 @09:34AM (#17644276)
Floating point numbers behave like rational numbers _with denominators that are powers of 2 only_.
Re:Is Cobol holding you hostage with Math? by taejo on Sunday July 29, 2018 @09:29AM (#17638021)
All floating point numbers are rational, but not all rational numbers are floating-point, including very simple ones like 1/3, and ones common in finance like 1/100, which is the point.
Re:Is Cobol holding you hostage with Math? by boomlinde on Sunday July 29, 2018 @02:22PM (#17639505)
1/3 and 1/100 are perfectly representable using floating point. Sure, I've never seen fp in base 3 in the wild, but base 10 isn't unusual for the exact reason you're pointing out.

So what I see is a conclusion that floating point is "emulated reals" as opposed to rationals, despite all floating point numbers being rational numbers and that decimal floating point is wrong and "the worst of both worlds", but I don't see a valid argument for it.