From f0a4bac4bde861bc639c8eca48682f96d7a751be Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 7 Feb 2017 11:00:44 +1100 Subject: Fixed Round and Value bugs in Rationals --- src/rationals.adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rationals.adb b/src/rationals.adb index 2255afe..7ae321c 100644 --- a/src/rationals.adb +++ b/src/rationals.adb @@ -339,7 +339,7 @@ package body Rationals is (Item : in Fraction) return Integer is begin - if Item.Num mod Item.Den > Standard."/" (Item.Den, 2) then + if Item.Num mod Item.Den >= Standard."/" (Item.Den, 2) then return 1 + Item.Num / Item.Den; else return Item.Num / Item.Den; @@ -371,7 +371,7 @@ package body Rationals is S := Index (Item, "/"); A := Integer'Value (Item (Item'First .. S - 1)); B := Integer'Value (Item (S + 1 .. Item'Last)); - return (Num => A, Den => B); + return Reduce (A, B); end Value; -- cgit