# HG changeset patch # User Bruno Haible # Date 1316275090 -7200 # Node ID a23d9939d7a5e19f7e6472b48c69b7cab992e8f5 # Parent e9fd9d86c6e0bae5e58051a78e398ac3530e9e5c isnanl, isnand, isnanf: Work around MSVC bug. * lib/isnan.c (FUNC): Use alternate ways of computing NaN and Infinity. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-17 Bruno Haible + + isnanl, isnand, isnanf: Work around MSVC bug. + * lib/isnan.c (FUNC): Use alternate ways of computing NaN and Infinity. + 2011-09-17 Bruno Haible sys_socket tests: Fix recent mistake. diff --git a/lib/isnan.c b/lib/isnan.c --- a/lib/isnan.c +++ b/lib/isnan.c @@ -117,17 +117,20 @@ # else /* Be careful to not do any floating-point operation on x, such as x == x, because x may be a signaling NaN. */ -# if defined __TINYC__ || defined __SUNPRO_C || defined __DECC \ - || (defined __sgi && !defined __GNUC__) || defined __ICC - /* The Sun C 5.0, Intel ICC 10.0, and Compaq (ex-DEC) 6.4 compilers don't - recognize the initializers as constant expressions. The latter compiler - also fails when constant-folding 0.0 / 0.0 even when constant-folding is - not required. The SGI MIPSpro C compiler complains about "floating-point - operation result is out of range". */ +# if defined __SUNPRO_C || defined __ICC || defined _MSC_VER \ + || defined __DECC || defined __TINYC__ \ + || (defined __sgi && !defined __GNUC__) + /* The Sun C 5.0, Intel ICC 10.0, Microsoft Visual C/C++ 9.0, Compaq (ex-DEC) + 6.4, and TinyCC compilers don't recognize the initializers as constant + expressions. The Compaq compiler also fails when constant-folding + 0.0 / 0.0 even when constant-folding is not required. The Microsoft + Visual C/C++ compiler also fails when constant-folding 1.0 / 0.0 even + when constant-folding is not required. The SGI MIPSpro C compiler + complains about "floating-point operation result is out of range". */ static DOUBLE zero = L_(0.0); memory_double nan; - DOUBLE plus_inf = L_(1.0) / L_(0.0); - DOUBLE minus_inf = -L_(1.0) / L_(0.0); + DOUBLE plus_inf = L_(1.0) / zero; + DOUBLE minus_inf = -L_(1.0) / zero; nan.value = zero / zero; # else static memory_double nan = { L_(0.0) / L_(0.0) };