langref: clarify functionality of the round builtin (#19503)

A test has also been added to demonstrate the expected behavior.

* std.math: update round doc comment to match the builtin
This commit is contained in:
T
2024-08-14 10:29:45 -07:00
committed by GitHub
parent b7a1ef3e19
commit eb7f318ea8
3 changed files with 16 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
const expect = @import("std").testing.expect;
test "@round" {
try expect(@round(1.4) == 1);
try expect(@round(1.5) == 2);
try expect(@round(-1.4) == -1);
try expect(@round(-2.5) == -3);
}
// test