summaryrefslogtreecommitdiff
path: root/gcc/ada/a-calfor.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-calfor.adb')
-rw-r--r--gcc/ada/a-calfor.adb14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/a-calfor.adb b/gcc/ada/a-calfor.adb
index 83d9cdc736b..10e9617022c 100644
--- a/gcc/ada/a-calfor.adb
+++ b/gcc/ada/a-calfor.adb
@@ -170,7 +170,12 @@ package body Ada.Calendar.Formatting is
-- Prevent rounding when converting to natural
- Sub_Second := Sub_Second * 100.0 - 0.5;
+ Sub_Second := Sub_Second * 100.0;
+
+ if Sub_Second > 0.0 then
+ Sub_Second := Sub_Second - 0.5;
+ end if;
+
SS_Nat := Natural (Sub_Second);
declare
@@ -249,7 +254,12 @@ package body Ada.Calendar.Formatting is
-- Prevent rounding when converting to natural
- Sub_Second := Sub_Second * 100.0 - 0.5;
+ Sub_Second := Sub_Second * 100.0;
+
+ if Sub_Second > 0.0 then
+ Sub_Second := Sub_Second - 0.5;
+ end if;
+
SS_Nat := Natural (Sub_Second);
declare