aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/s-exponr.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/libgnat/s-exponr.adb')
-rw-r--r--gcc/ada/libgnat/s-exponr.adb9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/ada/libgnat/s-exponr.adb b/gcc/ada/libgnat/s-exponr.adb
index ece53b5..ad7f401 100644
--- a/gcc/ada/libgnat/s-exponr.adb
+++ b/gcc/ada/libgnat/s-exponr.adb
@@ -57,8 +57,8 @@ function System.Exponr (Left : Num; Right : Integer) return Num is
subtype Double_T is Double_Real.Double_T;
-- The double floating-point type
- subtype Negative is Integer range Integer'First .. -1;
- -- The range of negative exponents
+ subtype Safe_Negative is Integer range Integer'First + 1 .. -1;
+ -- The range of safe negative exponents
function Expon (Left : Num; Right : Natural) return Num;
-- Routine used if Right is greater than 4
@@ -113,9 +113,12 @@ begin
return Num'Machine (Sqr * Sqr);
end;
- when Negative =>
+ when Safe_Negative =>
return Num'Machine (1.0 / Exponr (Left, -Right));
+ when Integer'First =>
+ return Num'Machine (1.0 / (Exponr (Left, Integer'Last) * Left));
+
when others =>
return Num'Machine (Expon (Left, Right));
end case;