msvcrt: fix _copysign(1., -0.) error

Piotr Caban piotr.caban at gmail.com
Mon Mar 23 09:34:39 CDT 2015


On 03/22/15 14:51, Kevin Chan wrote:
>   float CDECL MSVCRT__copysignf( float num, float sign )
>   {
> -    /* FIXME: Behaviour for Nan/Inf? */
> -    if (sign < 0.0)
> -        return num < 0.0 ? num : -num;
> -    return num < 0.0 ? -num : num;
> +    /* FIXME: Behaviour for signbit(NAN) is different in Linux and
> +     *        Windows, where Windows gives a zero for -NAN
> +     */
> +    if (signbit(sign))
> +        return signbit(num) ? num : -num;
> +    return signbit(num) ? -num : num;
It doesn't make sense to add this comment and remove it in next patch. I 
would also prefer if signbit fallback implementation is changed in this 
patch.

+/* FIXME: Doesnot work with +-NAN and -0. */
There's a typo in this comment. Also it works for NAN with sign bit set 
to 0.

+#define signbit(x) ((x) < 0 ? 1 : 0)
This can be simplified to:
#define signbit(x) ((x)<0)




More information about the wine-devel mailing list