Skip to content

Commit 205e8f9

Browse files
committed
remove last clause guards use.
1 parent 0407b3a commit 205e8f9

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

lib/aiken/math/rational.ak

+18-6
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,18 @@ pub fn round(self: Rational) -> Int {
406406

407407
when compare(abs(f), ratio(1, 2)) is {
408408
Less -> n
409-
Equal if is_negative -> n
410-
Equal -> n + 1
411-
Greater if is_negative -> n - 1
412-
Greater -> n + 1
409+
Equal ->
410+
if is_negative {
411+
n
412+
} else {
413+
n + 1
414+
}
415+
Greater ->
416+
if is_negative {
417+
n - 1
418+
} else {
419+
n + 1
420+
}
413421
}
414422
}
415423

@@ -456,8 +464,12 @@ pub fn round_even(self: Rational) -> Int {
456464

457465
when compare(abs(f), ratio(1, 2)) is {
458466
Less -> n
459-
Equal if is_even -> n
460-
Equal -> n + m
467+
Equal ->
468+
if is_even {
469+
n
470+
} else {
471+
n + m
472+
}
461473
Greater -> n + m
462474
}
463475
}

0 commit comments

Comments
 (0)