From b380d260ba56b30cba7681c43e1b699d05152cdc Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Tue, 27 May 2025 09:43:57 +0200 Subject: [PATCH] =?utf8?q?AVR:=20target/120441=20-=20Fix=20f7=5Fexp=20for?= =?utf8?q?=20|x|=20=E2=89=A5=20512.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit f7_exp limited exponents to 512, but 1023 * ln2 ≈ 709, hence 1024 is a correct limit. libgcc/config/avr/libf7/ PR target/120441 * libf7.c (f7_exp): Limit aa->expo to 10 (not to 9). (cherry picked from commit 672569cee76a1927d14b5eb754a5ff0b9cee1bc8) --- libgcc/config/avr/libf7/libf7.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgcc/config/avr/libf7/libf7.c b/libgcc/config/avr/libf7/libf7.c index 375becb854c1..eb27dc7385d0 100644 --- a/libgcc/config/avr/libf7/libf7.c +++ b/libgcc/config/avr/libf7/libf7.c @@ -1639,10 +1639,10 @@ void f7_exp (f7_t *cc, const f7_t *aa) return f7_set_nan (cc); /* The maximal exponent of 2 for a double is 1023, hence we may limit - to |A| < 1023 * ln2 ~ 709. We limit to 1024 ~ 1.99 * 2^9 */ + to |A| < 1023 * ln2 ~ 709. We limit to 1024 = 2^10 */ if (f7_class_inf (a_class) - || (f7_class_nonzero (a_class) && aa->expo >= 9)) + || (f7_class_nonzero (a_class) && aa->expo >= 10)) { if (f7_class_sign (a_class)) return f7_clr (cc); -- 2.47.2