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

SRFI-77 with more than one flonum representation

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.

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 

(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.



[*] 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.