[llvm] r187314 - [APFloat] Make all arithmetic operations with NaN produce positive NaNs.

Michael Gottesman mgottesman at apple.com
Sun Jul 28 22:39:33 PDT 2013


On Jul 28, 2013, at 5:06 PM, Owen Anderson <resistor at mac.com> wrote:

> 
> On Jul 27, 2013, at 2:49 PM, Michael Gottesman <mgottesman at apple.com> wrote:
> 
>> Author: mgottesman
>> Date: Sat Jul 27 16:49:25 2013
>> New Revision: 187314
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=187314&view=rev
>> Log:
>> [APFloat] Make all arithmetic operations with NaN produce positive NaNs.
>> 
>> IEEE-754R 1.4 Exclusions states that IEEE-754R does not specify the
>> interpretation of the sign of NaNs. In order to remove an irrelevant
>> variable that most floating point implementations do not use,
>> standardize add, sub, mul, div, mod so that operating anything with
>> NaN always yields a positive NaN.
>> 
>> In a later commit I am going to update the APIs for creating NaNs so
>> that one can not even create a negative NaN.
> 
> Is this actually desirable?  It seems that we still need to be able to create negative NaNs, for example when bitcasting integers to floats.

I am assuming you are referring to my comment in the commit. I was referring specifically to the following four specific methods that are used to create NaNs programmatically:

1. getQNaN()
2. getSNaN()
3. getNaN()
4. makeNaN()

Michael

> 
> --Owen




More information about the llvm-commits mailing list