From 205e8f9a06c6f3c9e7c93bb7745e390515e2e2cf Mon Sep 17 00:00:00 2001 From: KtorZ Date: Thu, 1 Aug 2024 16:26:17 +0200 Subject: [PATCH] remove last clause guards use. --- lib/aiken/math/rational.ak | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/aiken/math/rational.ak b/lib/aiken/math/rational.ak index 6bca643..d99ef20 100644 --- a/lib/aiken/math/rational.ak +++ b/lib/aiken/math/rational.ak @@ -406,10 +406,18 @@ pub fn round(self: Rational) -> Int { when compare(abs(f), ratio(1, 2)) is { Less -> n - Equal if is_negative -> n - Equal -> n + 1 - Greater if is_negative -> n - 1 - Greater -> n + 1 + Equal -> + if is_negative { + n + } else { + n + 1 + } + Greater -> + if is_negative { + n - 1 + } else { + n + 1 + } } } @@ -456,8 +464,12 @@ pub fn round_even(self: Rational) -> Int { when compare(abs(f), ratio(1, 2)) is { Less -> n - Equal if is_even -> n - Equal -> n + m + Equal -> + if is_even { + n + } else { + n + m + } Greater -> n + m } }