"Luke Palmer" schreef:
> When do we do integer/rational math and when do we do floating point
> That is, is 1 different from 1.0? Should 10**500 be infinity or a 1
> with 500 zeroes after it? Should 10**10**6 run out of memory? Should
> "say (1/3)**500" print a bunch of digits to the screen or print 0?
> These are just examples. Exponentials are the easiest to think about
> limit cases with, but the whole general issue needs precise semantics.
A Numeric could have multiple faces: Integer, Rational, Float, etc. Some
faces can have a Complex variant.
A bitstring could flag which faces are actual (usable, non-dirty).
Each face needs its own storage, for instance 1/2 could be stored as
Integer "0" (or "1", or alternating between them), Rational "1 / 2" (or
"2 ** -1"), Float "1B-1", etc.
Some conversions are without surprises, like from Integer to Float
(because loss of precision is normal when going from Integer to Float,
so even a difference of more than 1 is to be expected).
>From Float to (Big)Integer can result in an unexpected difference of 1.
Or even in Inf.
"Gewoon is een tijger."