[gambit-list] Discussion of fl<whatever> functions

Marc Feeley feeley at iro.umontreal.ca
Sun Feb 9 08:59:57 EST 2014


Yes you are right.  This is needed to be consistent with the IEEE-754 philosophy of using NaN as a return value of primitive operations to represent range errors.  Just like (fl/ 0. 0.) => +nan.0 we must have (fllog -1.0) => +nan.0 .

Will you write some unit tests to make sure the native C library returns a consistent value for these primitives (i.e. +nan.0 when the arguments are out of range)?

Marc

On Feb 8, 2014, at 2:06 PM, Bradley Lucier <lucier at math.purdue.edu> wrote:

> Marc:
> 
> I found a bug  in fllog1p (I think you meant to use (macro-inexact--1) instead of (macro-inexact-+1)) that caused me to look at a lot of the fl<whatever> functions.
> 
> I think you lost the trail here.  The fl<whatever> functions are supposed to just give you whatever the associated floating-point library functions give you, without checking for range conditions, etc.  For example, (fllog -1.0) is +nan.0, not "raise an exception".
> 
> So I went through _num.scm and tried to clean up those functions; the attached _num.diff is what I tentatively ended up with.
> 
> What do you think?
> 
> Brad
> 
> 
> <_num.diff>




More information about the Gambit-list mailing list