News for hackers. Stuff that matters.
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by kragen on Wednesday May 10, 2023 @04:47PM (#35893274)
that's slightly incoherent and reflective of the same confusion i identified; there is strictly speaking, no such thing as a decimal number, only a decimal numeral. normally the difference is subtle, but in this case it's the essence of the issue

'decimal' means 'base 10'

numbers, the abstract entities we do arithmetic on, are not decimal or in any other base; it is correct that arithmetic on them is not in any sense lossy

decimal is a system of representation that represents these abstract numbers as finite strings of digits; these are called 'numerals'. it can represent any integer, but only some fractions, those whose denominator has no prime factors other than 2 or 5. such fractions arise non-lossily as the result of the arithmetic operator of division when, for example, the dividend is 3. representing these in decimal requires rounding them, so decimal is lossy

binary floating point is lossy in the same way, with the additional limitation to only being able to represent fractions whose denominator is a power of 2, whose numerator does not have too many significant bits (53 most often), and which are not too positive, too negative, or too small

there are other systems of represention for numbers that are not lossy in this way. for example, improper fractions, mixed numbers, finite continued fractions, and decimal augmented with overbar to indicate repeated digits

Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to... by kragen on Thursday May 11, 2023 @10:47AM (#35902946)
this should read 'when, for example, the divisor is 3 and the dividend is an integer not divisible by 3'