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]

Re: Fix csin, csinh, ccos, ccosh missing underflows (bug 15405)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]