Re: Accuracy of Mathematical Functions

From: Paul Zimmermann <Paul.Zimmermann_at_inria.fr>
Date: Wed, 27 Sep 2023 08:57:01 UTC
       Hi Alexander,

> A thought just crossed my mind... should we consider to provide two ABI 
> compatible math libs, one fast (and "acceptable accurate"... whatever 
> this means), and one accurate (and this one being the default to link 
> against)? Users then could use libmap.conf(5) to use the one according 
> to their needs.

this is not the same idea, but the new C standard allows to have two
functions exp and cr_exp:

See https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf, page 454,
item 4:

   Function names that begin with cr_ are potentially reserved identifiers and
   may be added to the <math.h> header. The cr_ prefix is intended to indicate
   a correctly rounded version of the function.

Having both under the same name, and having a runtime dispatcher that chooses
either the fast version or the correctly rounded version, is a nice idea!

Paul