[r6rs-discuss] Two questions about writing inexact numbers

Alan Watson alan at alan-watson.org
Mon May 28 16:02:36 EDT 2007


Replying to your own posts is widely regarded as a sign of insanity, but 
nevertheless ...

Alan Watson wrote:
> (b) Is there a simple way to write a flonum in a way that will always be 
> read as a flonum (i.e., with an e exponent and no explicit mantissa 
> precision)?

I think this may depend on what I mean by "always".

If I mean "I want to be able to write a flonum on one implementation and 
guarantee (within range restrictions) that it will be read as a flonum 
on any other implementation", then I need to be able to write a flonum 
using an e exponent and no explicit mantissa precision. I do not think 
the standard gives me an easy way to do this. I believe I have to write 
my own number->string (possibly on top of the standard version).

If I mean "I want to write a flonum on one implementation and guarantee 
that it will be read a flonum on the same implementation", then I have 
to play with the meaning of equal? for flonums. Two inexact integers are 
equal? if the give the same results on Scheme's standard arithmetic 
procedures.

Question: Is flonum? a "standard arithmetic procedure"?

Regards,

Alan




More information about the r6rs-discuss mailing list