[PATCH] Returns NaN for sqrt with negative fp argument
liujiangning1 at gmail.com
Tue Jun 10 03:17:04 PDT 2014
> Or vice versa, why is fp zero a more reasonable implementation than NaN
> > this case?
> I'd say the best implementation would be undef (possibly even
> reporting a warning, though that's strictly QoI and probably better as
> a sanitizer anyway). I'm not sure why 0.0 is there at the moment
I think now I understand this a little bit. Following LLVM IR spec, when
using -ffast-math, -menable-no-nans are -menable-unsafe-fp-math enabled,
and this sounds reasonable to retain defined/stable/safe behavior, so we
can't return NaN, then 0.0 is a choice.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits