Commit 48f10834 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

msvcrt: Use isnan instead of isnanf.

This resolves several warnings when compiling with MinGW because isnanf is not in MinGW's math.h (it's not a standard C function). On the other hand, isnan is a widely available C99 macro designed for both floats and doubles. We also have an isnan implementation in libs/port/isnan.c for pre-C99 compilers. Signed-off-by: 's avatarAlex Henrie <alexhenrie24@gmail.com> Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f9beb7ff
...@@ -16535,7 +16535,6 @@ for ac_func in \ ...@@ -16535,7 +16535,6 @@ for ac_func in \
getpwuid \ getpwuid \
gettimeofday \ gettimeofday \
getuid \ getuid \
isnanf \
kqueue \ kqueue \
lstat \ lstat \
memmove \ memmove \
......
...@@ -2163,7 +2163,6 @@ AC_CHECK_FUNCS(\ ...@@ -2163,7 +2163,6 @@ AC_CHECK_FUNCS(\
getpwuid \ getpwuid \
gettimeofday \ gettimeofday \
getuid \ getuid \
isnanf \
kqueue \ kqueue \
lstat \ lstat \
memmove \ memmove \
......
...@@ -38,14 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); ...@@ -38,14 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define finitef(x) isfinite(x) #define finitef(x) isfinite(x)
#endif #endif
#ifndef HAVE_ISNANF
#ifdef HAVE_ISNAN
#define isnanf(x) isnan(x)
#else
#define isnanf(x) 0
#endif
#endif
/* FIXME: Does not work with -NAN and -0. */ /* FIXME: Does not work with -NAN and -0. */
#ifndef signbit #ifndef signbit
#define signbit(x) ((x) < 0) #define signbit(x) ((x) < 0)
...@@ -190,7 +182,7 @@ INT CDECL MSVCRT__isnanf( float num ) ...@@ -190,7 +182,7 @@ INT CDECL MSVCRT__isnanf( float num )
/* Some implementations return -1 for true(glibc), msvcrt/crtdll return 1. /* Some implementations return -1 for true(glibc), msvcrt/crtdll return 1.
* Do the same, as the result may be used in calculations * Do the same, as the result may be used in calculations
*/ */
return isnanf(num) != 0; return isnan(num) != 0;
} }
/********************************************************************* /*********************************************************************
...@@ -199,7 +191,7 @@ INT CDECL MSVCRT__isnanf( float num ) ...@@ -199,7 +191,7 @@ INT CDECL MSVCRT__isnanf( float num )
float CDECL MSVCRT__logbf( float num ) float CDECL MSVCRT__logbf( float num )
{ {
float ret = logbf(num); float ret = logbf(num);
if (isnanf(num)) math_error(_DOMAIN, "_logbf", num, 0, ret); if (isnan(num)) math_error(_DOMAIN, "_logbf", num, 0, ret);
else if (!num) math_error(_SING, "_logbf", num, 0, ret); else if (!num) math_error(_SING, "_logbf", num, 0, ret);
return ret; return ret;
} }
...@@ -245,7 +237,7 @@ float CDECL MSVCRT_atanf( float x ) ...@@ -245,7 +237,7 @@ float CDECL MSVCRT_atanf( float x )
float CDECL MSVCRT_atan2f( float x, float y ) float CDECL MSVCRT_atan2f( float x, float y )
{ {
float ret = atan2f(x, y); float ret = atan2f(x, y);
if (isnanf(x)) math_error(_DOMAIN, "atan2f", x, y, ret); if (isnan(x)) math_error(_DOMAIN, "atan2f", x, y, ret);
return ret; return ret;
} }
...@@ -265,7 +257,7 @@ float CDECL MSVCRT_cosf( float x ) ...@@ -265,7 +257,7 @@ float CDECL MSVCRT_cosf( float x )
float CDECL MSVCRT_coshf( float x ) float CDECL MSVCRT_coshf( float x )
{ {
float ret = coshf(x); float ret = coshf(x);
if (isnanf(x)) math_error(_DOMAIN, "coshf", x, 0, ret); if (isnan(x)) math_error(_DOMAIN, "coshf", x, 0, ret);
return ret; return ret;
} }
...@@ -275,7 +267,7 @@ float CDECL MSVCRT_coshf( float x ) ...@@ -275,7 +267,7 @@ float CDECL MSVCRT_coshf( float x )
float CDECL MSVCRT_expf( float x ) float CDECL MSVCRT_expf( float x )
{ {
float ret = expf(x); float ret = expf(x);
if (isnanf(x)) math_error(_DOMAIN, "expf", x, 0, ret); if (isnan(x)) math_error(_DOMAIN, "expf", x, 0, ret);
else if (finitef(x) && !ret) math_error(_UNDERFLOW, "expf", x, 0, ret); else if (finitef(x) && !ret) math_error(_UNDERFLOW, "expf", x, 0, ret);
else if (finitef(x) && !finitef(ret)) math_error(_OVERFLOW, "expf", x, 0, ret); else if (finitef(x) && !finitef(ret)) math_error(_OVERFLOW, "expf", x, 0, ret);
return ret; return ret;
...@@ -342,7 +334,7 @@ float CDECL MSVCRT_sinf( float x ) ...@@ -342,7 +334,7 @@ float CDECL MSVCRT_sinf( float x )
float CDECL MSVCRT_sinhf( float x ) float CDECL MSVCRT_sinhf( float x )
{ {
float ret = sinhf(x); float ret = sinhf(x);
if (isnanf(x)) math_error(_DOMAIN, "sinhf", x, 0, ret); if (isnan(x)) math_error(_DOMAIN, "sinhf", x, 0, ret);
return ret; return ret;
} }
...@@ -2943,9 +2935,9 @@ LDOUBLE CDECL MSVCR120_erfcl(LDOUBLE x) ...@@ -2943,9 +2935,9 @@ LDOUBLE CDECL MSVCR120_erfcl(LDOUBLE x)
*/ */
float CDECL MSVCR120_fmaxf(float x, float y) float CDECL MSVCR120_fmaxf(float x, float y)
{ {
if(isnanf(x)) if(isnan(x))
return y; return y;
if(isnanf(y)) if(isnan(y))
return x; return x;
if(x==0 && y==0) if(x==0 && y==0)
return signbit(x) ? y : x; return signbit(x) ? y : x;
...@@ -3008,9 +3000,9 @@ int CDECL MSVCR120__fdpcomp(float x, float y) ...@@ -3008,9 +3000,9 @@ int CDECL MSVCR120__fdpcomp(float x, float y)
*/ */
float CDECL MSVCR120_fminf(float x, float y) float CDECL MSVCR120_fminf(float x, float y)
{ {
if(isnanf(x)) if(isnan(x))
return y; return y;
if(isnanf(y)) if(isnan(y))
return x; return x;
if(x==0 && y==0) if(x==0 && y==0)
return signbit(x) ? x : y; return signbit(x) ? x : y;
...@@ -3232,7 +3224,7 @@ float CDECL MSVCR120_remainderf(float x, float y) ...@@ -3232,7 +3224,7 @@ float CDECL MSVCR120_remainderf(float x, float y)
#ifdef HAVE_REMAINDERF #ifdef HAVE_REMAINDERF
/* this matches 64-bit Windows. 32-bit Windows is slightly different */ /* this matches 64-bit Windows. 32-bit Windows is slightly different */
if(!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM; if(!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
if(isnanf(y) || y==0.0f) *MSVCRT__errno() = MSVCRT_EDOM; if(isnan(y) || y==0.0f) *MSVCRT__errno() = MSVCRT_EDOM;
return remainderf(x, y); return remainderf(x, y);
#else #else
FIXME( "not implemented\n" ); FIXME( "not implemented\n" );
......
...@@ -339,9 +339,6 @@ ...@@ -339,9 +339,6 @@
/* Define to 1 if you have the `isnan' function. */ /* Define to 1 if you have the `isnan' function. */
#undef HAVE_ISNAN #undef HAVE_ISNAN
/* Define to 1 if you have the `isnanf' function. */
#undef HAVE_ISNANF
/* Define to 1 if you have the `j0' function. */ /* Define to 1 if you have the `j0' function. */
#undef HAVE_J0 #undef HAVE_J0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment