[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fixnum-* operations

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.



The Rationale for the section "Fixnums" begins:

Rationale: The operations whose names begin with fixnum implement arithmetic on a quotient ring of the integers ...

No finite quotient ring of the integers is an ordered ring [1](any ordered ring with identity contains an isomorphic copy of the integers, so it is infinite), so the operations that rely on order, namely,

fixnum>
fixnum<
fixnum>=
fixnum<=
fixnum-positive?
fixnum-negative?
fixnum-max
fixnum-min

don't make sense.  I suggest they be removed.

Once they *are* removed, then there seems to be no reason to have (now partially) parallel definitions of fixnum-* operations, most of which do *exactly* the same thing as their fx* counterpart.

It would be more helpful identify and list the few fx* and fixnum-* operations that might overflow, and so have different semantics, and specify

Brad

[1] An ordered ring satisfies

(1) Given a and b, precisely one of a < b, a = b, or a > b is true.
(2) Given a < b and any c, a+c < b+c; and if c > 0 then a*c < b*c.
(3) x < y and y < z implies x < z.

The presumed fixnum-* operations, which claim to operate on a ring, rely on an ordering doesn't satisfy these properties. Without these properties, flow analysis, stated as one of the motivations of this SRFI, of inequalities is useless.