From: Johan Råde (rade_at_[hidden])
Date: 2008-02-26 05:03:35
John Maddock wrote:
> Johan Råde wrote:
>> If I enable SSE2 on VC71 and optimize the code for speed (/O2), then
>> returns a positive NaN (binary expansion 7ff8000000000000), while
>> returns a negative NaN (binary expansion fff8000000000000).
>> If I turn off the compiler optimization, then both return a negative
>> Conclusion: boost::math::changesign is useful.
> Well, if that's the only use, then personally I won't be using it, what use
> is a negative NaN over a positive one? This feels like a very borderline
> use case to me, but maybe I'm missing something?
Paul Bristow wanted support for negative NaN.
Unfortunately he is gone this week, and can not comment on this issue.
I think he had in mind that some users might want to record
extra information about the NaN through the signbit.
But as Guillaume has explained, that may not be the best way
to add information to the NaN.
Personally I have no strong opinion about this.
Currently negative NaN is formatted as "-nan".
Having changesign made it easier to implement and write tests for this functionality.
To me it seems logical to either keep both the formatting of negative NaN as "-nan"
and the changesign function, or to drop both.
Either way is fine with me.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk