Skip to content

Commit

Permalink
remove last clause guards use.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Aug 1, 2024
1 parent 0407b3a commit 205e8f9
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/aiken/math/rational.ak
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 205e8f9

Please sign in to comment.