[PATCH] D22104: [SimplifyLibCalls] pow(x, 0.5) -> fabs(sqrt(x)) (finite-only-mode)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 15:08:04 PDT 2016


On Thu, Jul 7, 2016 at 12:03 PM, James Molloy via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Hi,
>
> Am I being stupid? Why are you taking the absolute value of a square root
> - this should always be positive?
>

sqrt(-0.0) returns -0.0. pow(-0.0, 0.5) returns 0.0.  Floating point is fun.

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160707/b6b2856b/attachment.html>


More information about the llvm-commits mailing list