Sujet : Re: evolution of bytes, The joy of FORTRAN
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : alt.folklore.computers comp.os.linux.miscDate : 04. Mar 2025, 04:01:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vq5qdl$1j356$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Pan/0.162 (Pokrosvk)
On Tue, 4 Mar 2025 00:16:03 +0000, Pancho wrote:
If you need to represent rational numbers exactly, why not represent
them as a pair of integers? I find the idea that 1/3 needs to be exact,
but 1/7 doesn't, contrived.
Yes. That is why some higher-level languages have “rational” or “fraction”
as an explicit data type. I’m not aware of any hardware that builds it in,
probably because the operations are easy to represent in terms of basic
arithmetic on an underlying integer type.
Until, that is, you exceed the range available in your integer type.