[Ada] Fix off-by-one bug in underflow handling of Scaling
gcc/ada/ * libgnat/s-fatgen.adb (Scaling): Fix off-by-one bug for underflow.
This commit is contained in:
parent
e18e1b5f52
commit
bcc6807c4b
@ -784,7 +784,7 @@ package body System.Fat_Gen is
|
|||||||
-- Check for gradual underflow
|
-- Check for gradual underflow
|
||||||
|
|
||||||
if T'Denorm
|
if T'Denorm
|
||||||
and then Adjustment >= IEEE_Emin - (Mantissa - 1) - Exp
|
and then Adjustment >= IEEE_Emin - Mantissa - Exp
|
||||||
then
|
then
|
||||||
Expf := IEEE_Emin;
|
Expf := IEEE_Emin;
|
||||||
Expi := Exp + Adjustment - Expf;
|
Expi := Exp + Adjustment - Expf;
|
||||||
@ -807,6 +807,13 @@ package body System.Fat_Gen is
|
|||||||
Float_Word (IEEE_Ebias + Expf) * Exp_Factor;
|
Float_Word (IEEE_Ebias + Expf) * Exp_Factor;
|
||||||
|
|
||||||
if Expi < 0 then
|
if Expi < 0 then
|
||||||
|
-- Given that Expi >= -Mantissa, only -64 is problematic
|
||||||
|
|
||||||
|
if Expi = -64 then
|
||||||
|
XX := XX / 2.0;
|
||||||
|
Expi := -63;
|
||||||
|
end if;
|
||||||
|
|
||||||
XX := XX / T (UST.Long_Long_Unsigned (2) ** (-Expi));
|
XX := XX / T (UST.Long_Long_Unsigned (2) ** (-Expi));
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user