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 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.

-- 
Joseph S. Myers
joseph@codesourcery.com


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