[cfe-dev] signbit returns false for negative NaN

Stephen Canon scanon at apple.com
Fri Jun 6 14:36:13 PDT 2014


> On Jun 6, 2014, at 2:18 PM, Philip Reames <listmail at philipreames.com> wrote:
> 
> On 06/06/2014 01:02 PM, Chandler Carruth wrote:
>> 
>> The standards for C and C++, and consequentially Clang and LLVM, are terribly underspecified w.r.t. things like NaN behavior. =/ We have seen this before, and even if we fix it in Clang/LLVM I worry that it will regress as there are many places where we model NaNs in a manner slightly too aggressive to be strictly IEEE-754 conforming. =[
> Is being IEEE-754 conforming a worthwhile goal?  If so, we could talk about how to improve testing to prevent such regressions and find other latent bugs.  
> 
> I would generally argue in favour of conformance, but am not familiar with exactly what the C/C++ rules are.  

C and C++ recommend but do not require IEEE-754 conformance (they define a means for a platform to claim conformance, but do not require that it do so).  At least within Apple, we’ve historically put a fair bit of effort into maintaining IEEE-754 conformance, at least when it comes to the semantics of basic arithmetic in default rounding (like this case does).

> To say this differently, are there important optimizations we don't want to loose which aren't conforming?

We have relaxed modes (-ffast-math and friends) that license those optimizations.  The default mode should conform as much as reasonably possible.

– Steve



More information about the cfe-dev mailing list