From 27dae84ed92f1ef0300263091972338d12e78348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 18 Oct 2025 19:06:52 +0200 Subject: New upstream version 1.4.1 --- lib/isnan.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lib/isnan.c') diff --git a/lib/isnan.c b/lib/isnan.c index c7d84e8d..915187ba 100644 --- a/lib/isnan.c +++ b/lib/isnan.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -130,15 +130,13 @@ FUNC (DOUBLE x) /* Be careful to not do any floating-point operation on x, such as x == x, because x may be a signaling NaN. */ # if defined __SUNPRO_C || defined __ICC || defined _MSC_VER \ - || defined __DECC || defined __TINYC__ \ - || (defined __sgi && !defined __GNUC__) + || defined __DECC || defined __TINYC__ /* 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". */ + when constant-folding is not required. */ static DOUBLE zero = L_(0.0); memory_double nan; DOUBLE plus_inf = L_(1.0) / zero; @@ -158,8 +156,8 @@ FUNC (DOUBLE x) if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD]) & (EXP_MASK << EXPBIT0_BIT)) == 0) - return (memcmp (&m.value, &plus_inf, SIZE) != 0 - && memcmp (&m.value, &minus_inf, SIZE) != 0); + return (!memeq (&m.value, &plus_inf, SIZE) + && !memeq (&m.value, &minus_inf, SIZE)); else return 0; } @@ -179,7 +177,7 @@ FUNC (DOUBLE x) memset (&m2.value, 0, SIZE); m1.value = x; m2.value = x + (x ? 0.0L : -0.0L); - if (memcmp (&m1.value, &m2.value, SIZE) != 0) + if (!memeq (&m1.value, &m2.value, SIZE)) return 1; # endif return 0; -- cgit v1.2.3 From 5f59a34ab747dde8ede7357f3431bf06bd6002fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 Mar 2026 17:28:33 +0100 Subject: New upstream version 1.4.2 --- lib/isnan.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/isnan.c') diff --git a/lib/isnan.c b/lib/isnan.c index 915187ba..491dc6dc 100644 --- a/lib/isnan.c +++ b/lib/isnan.c @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -105,10 +105,8 @@ FUNC (DOUBLE x) The NaN bit pattern is: - exponent = 0x7FFF, mantissa >= 0x8000000000000001. */ memory_double m; - unsigned int exponent; - m.value = x; - exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK; + unsigned int exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK; # ifdef WORDS_BIGENDIAN /* Big endian: EXPBIT0_WORD = 0, EXPBIT0_BIT = 16. */ if (exponent == 0) @@ -138,9 +136,9 @@ FUNC (DOUBLE x) Visual C/C++ compiler also fails when constant-folding 1.0 / 0.0 even when constant-folding is not required. */ static DOUBLE zero = L_(0.0); - memory_double nan; DOUBLE plus_inf = L_(1.0) / zero; DOUBLE minus_inf = -L_(1.0) / zero; + memory_double nan; nan.value = zero / zero; # else static memory_double nan = { L_(0.0) / L_(0.0) }; @@ -149,10 +147,10 @@ FUNC (DOUBLE x) # endif { memory_double m; + m.value = x; /* A NaN can be recognized through its exponent. But exclude +Infinity and -Infinity, which have the same exponent. */ - m.value = x; if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD]) & (EXP_MASK << EXPBIT0_BIT)) == 0) @@ -171,12 +169,13 @@ FUNC (DOUBLE x) # if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE /* Detect any special bit patterns that pass ==; see comment above. */ memory_double m1; - memory_double m2; - memset (&m1.value, 0, SIZE); - memset (&m2.value, 0, SIZE); m1.value = x; + + memory_double m2; + memset (&m2.value, 0, SIZE); m2.value = x + (x ? 0.0L : -0.0L); + if (!memeq (&m1.value, &m2.value, SIZE)) return 1; # endif -- cgit v1.2.3