[gambit-list] Test 5 failed

Marc Feeley feeley at iro.umontreal.ca
Thu Oct 20 19:40:37 EDT 2011


On 2011-10-20, at 5:54 PM, Bradley Lucier wrote:

> 
> On Oct 20, 2011, at 3:42 PM, Marc Feeley wrote:
> 
>> On 2011-10-20, at 3:39 PM, Bradley Lucier wrote:
>> 
>>> Perhaps +nan.0 (and perhaps other system-dependent constants) should always be computed at load time for the module.
>> 
>> Perhaps, but how do you recreate the NaN that was compiled?
> 
> But why would you want to?

So that gsc is a function of one argument: from Scheme source code to C source code, i.e.

    Scheme_source -> C_source

instead of

    Scheme_source * platform -> C_source

>  On one machine, it might be a signaling NaN, on another, it might be silent.

But there is just one +nan.0 available in Scheme source code.  We are talking about the representation of this NaN, not all possible NaNs.

Portability is one of the primary objectives of Gambit.  If the platform becomes an implicit parameter of gsc, then Scheme code compiled to C on one platform, will not work in all cases on another.  For example, gsc could have been designed to require the compilation platform and the target platform to have the same word width, but that would limit its use.  Moreover, it wouldn't be possible to distribute Gambit as a set of C generated files, and expect it to work on all platforms.  Same goes for endianness.  Having a normalized representation for +nan.0 is consistent with portability.

Perhaps I'm missing something... can you explain a use case where it would be interesting for gsc to preserve a particular bit pattern for NaNs?

Marc




More information about the Gambit-list mailing list