msvcrt: Add INFINITY and NAN definitions to math.h.

Francois Gouget fgouget at
Fri Jan 10 10:44:39 CST 2014

On Fri, 10 Jan 2014, Jacek Caban wrote:
> Looking at how it's done in my Linux headers, there is 
> __builtin_nanf() and __builtin_inff() guarded by GCC >= 3.3 that we 
> could use.

This would work on Linux. But the Solaris headers don't define NAN which 
is what uncovered this problem in the first place... In other words the 
msvcrt headers cannot rely on the system headers to define INFINITY and 

> How is it defined on MSVC?

They define INFINITY by multiplying two very large floats that they know 
will overflow (which makes assumptions on the maximum exponant and 
causes a Visual C++ compiler warning).

Then they define NAN as INFINITY * 0.

Francois Gouget <fgouget at>    
    I haven't lost my mind, it's backed up on tape around here somewhere...

More information about the wine-devel mailing list