]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: target/120441 - Fix f7_exp for |x| ≥ 512.
authorGeorg-Johann Lay <avr@gjlay.de>
Tue, 27 May 2025 07:43:57 +0000 (09:43 +0200)
committerGeorg-Johann Lay <avr@gjlay.de>
Tue, 27 May 2025 07:55:31 +0000 (09:55 +0200)
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).

libgcc/config/avr/libf7/libf7.c

index a64554c562fda462e6a72cac76b614bd3b524792..7d70804a59adb5984531d93f47cfc1b71a049793 100644 (file)
@@ -1649,10 +1649,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);