Mercurial > hg > octave-kai > gnulib-hg
changeset 15641:a23d9939d7a5
isnanl, isnand, isnanf: Work around MSVC bug.
* lib/isnan.c (FUNC): Use alternate ways of computing NaN and Infinity.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 17 Sep 2011 17:58:10 +0200 |
parents | e9fd9d86c6e0 |
children | 5f0f5820c414 |
files | ChangeLog lib/isnan.c |
diffstat | 2 files changed, 17 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-17 Bruno Haible <bruno@clisp.org> + + isnanl, isnand, isnanf: Work around MSVC bug. + * lib/isnan.c (FUNC): Use alternate ways of computing NaN and Infinity. + 2011-09-17 Bruno Haible <bruno@clisp.org> sys_socket tests: Fix recent mistake.
--- 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) };