[LLVMdev] Related constant folding of floating point values

Renato Golin renato.golin at linaro.org
Wed Oct 9 08:06:34 PDT 2013


On 9 October 2013 15:43, Mark Lacey <mark.lacey at apple.com> wrote:

> No. The issue is that you are taking a double (8.1), converting it to
> float, and then subtracting the original double from it. The rounding error
> introduced from the conversion is larger than the epsilon value that you
> are comparing to, so the first comparison (a-8.1 >= FLT_EPSILON) is always
> true.
>

Yes, my bad, FLT_EPSILON ends up as a double constant, so not denormalized,
but the error introduced is larger than epsilon anyway.

--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131009/b6ee09cb/attachment.html>


More information about the llvm-dev mailing list