Date: Sat, 26 Feb 2005 18:05:49 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: das@FreeBSD.ORG Cc: cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/lib/msun/src e_expf.c Message-ID: <20050226.180549.113100483.imp@bsdimp.com> In-Reply-To: <20050226023149.GA63314@VARK.MIT.EDU> References: <200502240632.j1O6WDP9029589@repoman.freebsd.org> <20050226023149.GA63314@VARK.MIT.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20050226023149.GA63314@VARK.MIT.EDU> David Schultz <das@FreeBSD.ORG> writes: : On Thu, Feb 24, 2005, David Schultz wrote: : > das 2005-02-24 06:32:13 UTC : > : > FreeBSD src repository : > : > Modified files: : > lib/msun/src e_expf.c : > Log: : > Revert rev 1.8, which causes small (e.g. 2 ulp) errors for some : > inputs. The trouble with replacing two floats with a double is that : > the latter has 6 extra bits of precision, which actually hurts : > accuracy in many cases. All of the constants are optimal when float : > arithmetic is used, and would need to be recomputed to do this right. : : This is related to a good reason why we can't switch the default : precision on i386 to extended. Many of the functions in libm use : minimax approximations, which are ``optimal'' approximations in : the sense that their maximum error over all in-range inputs is the : smallest possible (unless more terms are used). These approximations : take rounding error into account, so when the machine precision is : increased, they're no longer optimal and the error in the approximation : can increase significantly. There are less efficient methods that : don't depend on the exact machine precision, e.g. Chebyshev : approximations, but it would be a PITA to switch everything. I guess it comes down to which is more important: long double working outside of the double range, or small errors in these functions. I think the former is, but will defer to those with greater floating point foo. Since to make long double working by setting extended mode in the application would also break things in the manner you describe. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050226.180549.113100483.imp>