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 pow (0.0, -Inf) (bug 14241)


On 06/15/2012 01:17 PM, Joseph S. Myers wrote:
On Fri, 15 Jun 2012, Andreas Jaeger wrote:

-    if (ABS(y) > 1.0e20) return (y>0)?0:INF.x;
+    if (ABS(y) > 1.0e20) return (y>0)?0:1.0/ABS(x);
      k = checkint(y);
      if (k == -1)
        return y < 0 ? 1.0/x : x;

Can't we just revert this - just using INF.x in both places? Why do we need
the division here?

When y is finite, the divide-by-zero exception is required, which means the division must be executed. It's the case of infinite y where ideally there would be no exception (as per the IEEE 754 semantics that divide-by-zero exceptions are for exact infinities as results for operations on *finite* operands) and C11 makes the exception optional.

thanks for the explanation. In that case your changes 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



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