diff options
author | Eduardo Julian | 2016-12-02 21:46:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-12-02 21:46:23 -0400 |
commit | 6dc77468ed29dde0f83a73661bae0fda02de7aed (patch) | |
tree | 7f7855f53a48c0b44c01ef5f4d570c38ae3b2454 /stdlib/source/lux/math/ratio.lux | |
parent | 9f237c5c5a12dc4aa3b4fbd486586050bf84b2b8 (diff) |
- gcd and lcm functions now work on Nat, instead of Int.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/math/ratio.lux | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/stdlib/source/lux/math/ratio.lux b/stdlib/source/lux/math/ratio.lux index 5fb82c8a5..c2c9e7183 100644 --- a/stdlib/source/lux/math/ratio.lux +++ b/stdlib/source/lux/math/ratio.lux @@ -24,7 +24,8 @@ (def: #hidden (normalize (^slots [#numerator #denominator])) (-> Ratio Ratio) - (let [common (math;gcd numerator denominator) + (let [common (nat-to-int (math;gcd (int-to-nat (i:abs numerator)) + (int-to-nat (i:abs denominator)))) numerator (i./ common numerator) denominator (i./ common denominator)] {#numerator (if (and (i.< 0 numerator) |