• Exactness Sergei Egorov (04 Nov 2026 16:24 UTC)
    • Re: Exactness Peter McGoron (05 Nov 2026 22:37 UTC)

Re: Exactness Peter McGoron 05 Nov 2026 22:32 UTC

Although times are “inexact,” in all Scheme implementations nowadays
“inexact number” is a synonym for “floating-point number.” Binary32
numbers will have precision errors for nanoseconds or UNIX timestamps,
so the API forbids that potential error path. Even with Binary64
numbers, I feel that integer calculations with floating-point will
become fragile.

I am thinking of changing the API to split up seconds (which currently
can be rational) into seconds and nanoseconds. That way, one does not
have to deal with an implementation’s possibly slow rational numbers.
The nanoseconds will be allowed to be rational if one wants attosecond
precision, but basically all code can run on integers. Representing
nanoseconds requires 30 bits for an integer, and rational nanoseconds
will probably be very scarcely used.

Overall, I think support for implementations that cannot represent 32
bit numbers precisely is not important enough to add corner cases that
implementers and users have to worry about.

-- Peter McGoron