SRFI-77 with more than one flonum representation Alan Watson (20 Jun 2006 05:41 UTC)
Re: SRFI-77 with more than one flonum representation John Cowan (20 Jun 2006 13:36 UTC)
Re: SRFI-77 with more than one flonum representation Alan Watson (21 Jun 2006 21:34 UTC)

SRFI-77 with more than one flonum representation Alan Watson 20 Jun 2006 05:41 UTC

I think that the flonum-specific parts of SRFI-77 has some issues when
there is more than one flonum representation[*]. For example, consider
an implementation with IEEE 754 single-precision and double-precision
flonums.

(a) Does (fixnum->flonum 0) return a single-precision or a
double-precision flonum?

(b) If x and y are single-precision flonums whose sum cannot be
represented as a finite single-precision flonum, does (fl+ x y) return a
single-precision infinity or a double-precision finite value?

(c) How do I convert between single-precision and double-precision flonums?

I suspect there may be other issues.

Regards,

Alan

[*] Why support anything other than double? Well, long double can be
useful in certain algorithms. Furthermore, external data is often
represented as shorts: if such data is represented internally as
doubles, the additional precision and range can cause problems. Finally,
on a 64-bit machine you can probably unbox shorts, which may make
arithmetic with shorts significantly faster than arithmetic with
doubles. I'm sure other people can come up with other justifications.