Skip to content

Commit 2b479b5

Browse files
committed
math: cleanup floor.v, remove the last goto in the math module
1 parent d1ec41c commit 2b479b5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎vlib/math/floor.v‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,13 @@ pub fn round(x f64) f64 {
8484
mut y := floor(x) // Fractional part
8585
mut r := x - y // Round up to nearest.
8686
if r > 0.5 {
87-
unsafe {
88-
goto rndup
89-
}
87+
y += 1.0
88+
return y
9089
}
9190
// Round to even
9291
if r == 0.5 {
9392
r = y - 2.0 * floor(0.5 * y)
9493
if r == 1.0 {
95-
rndup:
9694
y += 1.0
9795
}
9896
}

0 commit comments

Comments
 (0)