Sujet : Re: "A diagram of C23 basic types"
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 27. Jun 2025, 03:33:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103kvst$3tgp3$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 27.06.2025 02:10, Keith Thompson wrote:
scott@slp53.sl.home (Scott Lurndal) writes:
[...]
But not all decimal floating point implementations used "hex floating point".
>
Burroughs medium systems had BCD floating point - one of the advantages
was that it could exactly represent any floating point number that
could be specified with a 100 digit mantissa and a 2 digit exponent.
BCD uses 4 bits to represent values from 0 to 9. That's about 83%
efficent relative to pure binary. (And it still can't represent 1/3.)
That's a problem of where your numbers stem from. "1/3" is a formula!
A standard representation for a number may be "0.33" or "0.33333333",
defined through the human-machine interface as text and representable
(as depicted) as "exact number". The result of the formula "1/3" isn't
representable as a finite decimal string. With a binary representation
even a _finite_ [decimal] string might not be exactly representable in
some cases; I've tried with 0.1 (for example). The fixed point decimal
representation calculates that exact, but not the binary. I think that
is the reason why especially in the financial sector using languages
that are supporting the decimal encoding had been prevalent. (Don't
know about contemporary financial systems.)
Janis
[...]