This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix csin, csinh, ccos, ccosh missing underflows (bug 15405)
- From: Andreas Jaeger <aj at suse dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 26 Apr 2013 21:14:52 +0200
- Subject: Re: Fix csin, csinh, ccos, ccosh missing underflows (bug 15405)
- References: <Pine dot LNX dot 4 dot 64 dot 1304261547100 dot 27966 at digraph dot polyomino dot org dot uk> <517AB041 dot 30705 at suse dot com> <Pine dot LNX dot 4 dot 64 dot 1304261711130 dot 27966 at digraph dot polyomino dot org dot uk>
On 04/26/2013 07:15 PM, Joseph S. Myers wrote:
On Fri, 26 Apr 2013, Andreas Jaeger wrote:
+ if (fabs (__real__ retval) < DBL_MIN)
+ {
+ volatile double force_underflow
+ = __real__ retval * __real__ retval;
+ (void) force_underflow;
+ }
+ if (fabs (__imag__ retval) < DBL_MIN)
+ {
+ volatile double force_underflow
+ = __imag__ retval * __imag__ retval;
+ (void) force_underflow;
+ }
Couldn't this be an else if? I expect we only need to raise underflow once if
both are underflowing, aren't we?
Generically the reason to avoid "else if" in such cases is to avoid issues
in the case where the first part was an exact zero (so meets the if
condition, but the multiplication shouldn't and doesn't cause underflow)
while the second is a genuine underflow that needs the multiplication to
get the exception. Maybe the case of exact zero doesn't occur here, but
it's more obvious without the "else" that the exception will always be
raised if needed (and I don't think either the zero case or the underflow
case is going to be the common case).
OK, then let's use the patch as is,
Thanks,
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