On 2024-03-03 03:21:26 +0100, Alejandro Colomar wrote: > Hi Morten, > > On Sat, Mar 02, 2024 at 09:02:24PM -0500, Morten Welinder wrote: > > Thanks. > > > > There is (was?) already crlibm out there. > > https://core-math.gitlabpages.inria.fr/ No particular need for wheel > > reinvention here. > > crlibm doesn't seem to exist anymore. The sources are still available at more non-official mirror, but it is no longer maintained. > Maybe just add some headers to core-math, and package it as a > standalone library. The issue is that it is not portable yet. > > FWIW, it appears that the author of the glibc exp10 implementation > > agrees with me that the implementation is sub-standard: > > > > https://codebrowser.dev/glibc/glibc/math/e_exp10.c.html > > > > /* This is a very stupid and inprecise implementation. It'll get > > replaced sometime (soon?). */ > > return __ieee754_exp (M_LN10 * arg); > > Hmmm. Still, it's simple. If pow(10, x) is strictly better, maybe one > can prove it and send a patch. Or for something better, it'll take more > work. If by "strictly better", you mean that for each input, it returns a result that is at least as accurate as the one returned by the above expression, then, probably no. The reason is that the rounding errors in the above expression may partly compensate on a random basis. So, for some proportion of inputs, you'll actually get an accurate result. And unless pow is designed to be almost correctly rounded, it will probably be sometimes worse. -- Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)