working on a cross-platform calculator application, i just noticed that on W32 NaN/Inf values are converted differently to strings than on OSX/linux. namely.
linux/OSX uses nan
rsp inf
, whereas W32 uses something like 1.#INF
resp. 1.#QNAN
.
what's the canonical way to get an identical representation on all platforms?
i'd like to avoid manually checking values with isnan()
and isinf()
and hardcoding the inf
resp nan
string representations.
(i read some comment in What is the difference between IND and NAN numbers that the actual "culprit" is the libc implementation, rather than the platform).