Re: Accuracy of Mathematical Functions

From: Alexander Leidinger <Alexander_at_Leidinger.net>
Date: Wed, 27 Sep 2023 08:32:18 UTC
Am 2023-09-26 20:08, schrieb Steve Kargl:
> On Tue, Sep 26, 2023 at 03:26:16PM +0200, Alexander Leidinger wrote:
>> Am 2023-09-25 15:50, schrieb Paul Zimmermann:
>> 
>> > We have updated our comparison:
>> >
>> > https://members.loria.fr/PZimmermann/papers/accuracy.pdf
>> >
>> > This new update includes for the first time the FreeBSD math library,
>> > whose accuracy is quite good, except:
>> 
>> I wonder how those functions/libs you tested compare in terms of 
>> speed...
>> It would allow to provide a hint to the question
>>   "Which lib is the fastest and fulfills the needs in terms of 
>> accuracy for
>> the intended use-case?"
>> 
>> I agree that the best way to do this requires to run all libs on the 
>> same
>> hardware and OS, which is not feasible in your approach. What may be
>> feasible is to compare the relative performance of those subsets, 
>> which you
>> run on the same hardware.
>> 
> 
> Speed vs accuracy is always a trade-off.  Consider

Yes.

[examples]
> The latter is more accurate, but its underlying algorithm
> uses summation-and-carry of the ascending series.  This
> algorithm is sensitive to compiler options, so I haven't
> pushed it FreeBSD (, yet).

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.

Bye,
Alexander.

-- 
http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF