diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-02-07 11:00:44 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-02-07 11:00:44 +1100 |
commit | f0a4bac4bde861bc639c8eca48682f96d7a751be (patch) | |
tree | 53e7682039cd09ae9ae8675100622b4d3dcd69e9 /src | |
parent | 8a7c0dd18cb373a5b3c69e13f110562e156575e9 (diff) |
Fixed Round and Value bugs in Rationals
Diffstat (limited to 'src')
-rw-r--r-- | src/rationals.adb | 4 |
1 files 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; |