[gambit-list] Which function in libm are portable enough to assume that they will be on all platforms?

Marc Feeley feeley at iro.umontreal.ca
Thu Oct 31 10:40:26 EDT 2013


On Oct 31, 2013, at 9:40 AM, Bradley Lucier <lucier at math.purdue.edu> wrote:

> 
> On Oct 31, 2013, at 8:16 AM, Marc Feeley wrote:
> 
>> 
>> If you define
>> 
>> (define (flsinh x)
>> (fl* 0.5 (fl- (flexp x) (flexp (fl- x)))))
>> 
>> (define (flcosh x)
>> (fl* 0.5 (fl+ (flexp x) (flexp (fl- x)))))
>> 
>> (define (fltanh x)
>> (let ((a (flexp (fl* 2.0 x))))
>>   (fl/ (fl- a 1.0) (fl+ a 1.0))))
>> 
>> can you use those functions to improve the precision of complex asin and acos?
> 
> No
> 
>> Can these Scheme definitions be improved?
> 
> Yes
> 
>> And how good is the precision when compared to the C sinh and cosh?
> 
> Crap.
> 
> Marc, I'm too busy right now to prepare a lecture on this stuff.
> 
> Brad

I'm asking these questions to respond to your initial question:

On Oct 30, 2013, at 11:30 PM, Bradley Lucier <lucier at math.purdue.edu> wrote:

> So my question is---is it reasonable to import these floating-point functions into Gambit to make better versions of the standard functions?

I think it is "reasonable" if both

1) most C libm implementations have good precision sinh, etc (where "good" means better than the above portable definitions)

2) in case the C libm sinh, etc have poor precision, the use of the above portable definitions in the definition of complex asin and acos gives no worse precision than the current implementation in Gambit.

Marc




More information about the Gambit-list mailing list