The base representation of NaN contains a signed bit, and this is what printf looks at when deciding whether it should print minus or not.
The reason the standard states that the sign bit should be ignored is to allow things like negation or absolute, just change the sign bit, without being forced to check if the input value was NaN.
source share