I am working on converting some software to using the fmt library, which was previously using a combination of double-conversion
, iostream
, and boost::format
. The majority of numeric values being output are double precision floating point, and we have a number of tests which check for corner cases involving infinities, nan, etc.
My problem is that, with fmt, many of the test outputs have changed to display negative-not-numbers: -nan
, which is a completely nonsense concept to me.
I realize that IEEE-754 spec allows for a large number of different bit representations of nan
s, including the sign bit being either set or cleared. But all I want to know is if a value is a number or not. Once a value is nan
, I don't care if someone has attempted to negate that value. The result of any arithmetic on nan
should just be nan
. The negative sign adds no meaningful value.
So how can I omit the negative sign on double
-nan
values when using libfmt?