This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/706] pow() produces inaccurate results for base ~ 1.0, and large exponent on 32-bit x86
- From: "calixte dot denizet at scilab-enterprises dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Sat, 25 Feb 2012 16:06:18 +0000
- Subject: [Bug math/706] pow() produces inaccurate results for base ~ 1.0, and large exponent on 32-bit x86
- Auto-submitted: auto-generated
- References: <bug-706-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=706
--- Comment #9 from Calixte <calixte.denizet@scilab-enterprises.com> 2012-02-25 16:06:18 UTC ---
Created attachment 6245
--> http://sourceware.org/bugzilla/attachment.cgi?id=6245
C code with a better algorithm
Hi all,
When the exponent is an integer, a fast exponentiation is used and when it is
negative the base is inverted before (cf e_pow.S). So in this case the error
induced by the inversion is cumulated in squaring several times. In the present
case base=(2^53-1)*2^(-53), exponent=2^54 and 1/base=(2^52+1)*2^(-52),
classical approximation shows that (1/base)^(2^54))~exp(4) and
1/(base^(2^54))~exp(2). So an easy way to avoid to cumulated error induced by
inversion is to invert the result rather than invert the base.
The attached code (in C) shows that clearly. I'm not able to fix the assembly
code in e_pow.S, so I let experimented people do that.
Thanks
Calixte
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.