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

Re: Some comments relating to ICFP contest

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.




On Wed, 26 Jul 2006, Alan Watson wrote:

> Consider data types with 32 bits and 64 bits but which are not
> numbers in the sense that the generic arithmetic operations cannot
> be used with them without an explicit conversion. Appropriate type-
> specific arithmetic and logical operations could be defined for
> these types. This would not be especially difficult to implement in
> a well-designed Scheme.

I agree with this.  Once you're worried about exact width in
bits you're not using them as numbers any more.  They are
bitfields, and they have a beginning and an end.

There should be "bitmath" operators that do (well-defined modular)
math on bitfields assuming particular binary representations of
numbers, to the same extent that there should be "bitstring"
operations that do well-defined character-manipulation operations on
bitfields assuming particular binary representations of strings.

But we should not guarantee errors in the math routines we use on
(generic) numbers; an overflow or roundoff error is just that, an
error, and the standard ought never prohibit an implementor from
trying to avoid errors. Nor should we ever guarantee that certain
values cannot be represented as numbers, because once again that
puts the standard in the position of requiring errors.

				Bear