aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
authorT <torque@users.noreply.github.com>2024-08-14 10:29:45 -0700
committerGitHub <noreply@github.com>2024-08-14 10:29:45 -0700
commiteb7f318ea897d51082b70c84591242735c8a2c53 (patch)
tree3c77d9f03480a6fa5ec80cffc6ef5fa5884dbf36 /lib/std/math.zig
parentb7a1ef3e19039690b182a295dff7cffe5fcc521f (diff)
downloadzig-eb7f318ea897d51082b70c84591242735c8a2c53.tar.gz
zig-eb7f318ea897d51082b70c84591242735c8a2c53.zip
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
Diffstat (limited to 'lib/std/math.zig')
-rw-r--r--lib/std/math.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig
index 39e1a157da..0c00818a1e 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -1140,7 +1140,8 @@ test ByteAlignedInt {
try testing.expect(ByteAlignedInt(u129) == u136);
}
-/// Rounds the given floating point number to an integer, away from zero.
+/// Rounds the given floating point number to the nearest integer.
+/// If two integers are equally close, rounds away from zero.
/// Uses a dedicated hardware instruction when available.
/// This is the same as calling the builtin @round
pub inline fn round(value: anytype) @TypeOf(value) {