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:
10
doc/langref/test_round_builtin.zig
Normal file
10
doc/langref/test_round_builtin.zig
Normal 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
|
||||
Reference in New Issue
Block a user