msvcrt: Fix bugs in math.c

Zheng Chen chanchengcc at
Sun Mar 22 11:54:55 CDT 2015

Hi Piotr,

>     It would be nice to also change signbit definition on systems that
>>>     doesn't support it, so it at least works for normal numbers.
>>> The signbit() function is actually part of C99, not my implementation,
>>> so I think it should be supported on most systems? Though I am not quite
>>> sure...
>> It's not available when compiled with Visual Studio. There's following
>> code in math.c:
>>     #ifndef signbit
>>     #define signbit(x) 0
>>     #endif
>> I think it would be better if it's at least changed to something like:
>> #define signbit(x) ((x)<0 ? 1 : 0)
>> It will not work correctly for -NAN or -0 but it will not break the cases
>> where old implementation was working.
> Sorry I didn't notice my program in VS was linked to the C++ lib for this
> signbit() function.
> "#define signbit(x) ((x)<0 ? 1 : 0)"  Looks good to me, I will submit a
> patch. Thanks for the advice :)
Just came to me that maybe we should include isnan() in signbit() instead
of using isnan() in _copysign(), seems like that's how Windows does it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the wine-devel mailing list