This is the mail archive of the
`libc-alpha@sourceware.org`
mailing list for the glibc project.

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |

Other format: | [Raw text] |

*From*: Andreas Jaeger <aj at suse dot com>*To*: libc-alpha at sourceware dot org*Date*: Fri, 25 May 2012 09:59:19 +0200*Subject*: Re: Fix acosf underflow (bug 14153)*References*: <Pine.LNX.4.64.1205242151360.19328@digraph.polyomino.org.uk>

Bug 14153 is a spurious underflow exception from acosf (2e-17); the cause is the acosf implementation calculating a value on the order of the cube of its argument, which underflows. There is a test for very small arguments, maybe to avoid underflow, and if such an argument is encountered it returns pi/2 (computed by adding high and low parts, I suppose to get correct results for the current rounding mode and to raise the inexact exception). However, this tests for values no more than 2**-57, as if the test was unchanged from a "double" version of the function; it suffices to test for values no more than 2**-26, which avoids the problem with internal underflows. (For small x, the correct value is essentially pi/2 - x. Compute pi/2 rounded to 25 bits - one more bit than float - which is the nearest value that is representable as float or half way between two representable values. Compute the difference of pi/2 and that rounded values; if |x| is smaller than that difference then the result of rounding pi/2 - x will be the same in any rounding mode as the result of rounding pi/2. Now that difference is more than 2**-26.)

I propose this patch fixing the bug that way. Tested x86_64 and x86.

thanks, this is fine,

Andreas -- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126

**References**:**Fix acosf underflow (bug 14153)***From:*Joseph S. Myers

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |