aboutsummaryrefslogtreecommitdiff
path: root/std/math/trunc.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/math/trunc.zig')
-rw-r--r--std/math/trunc.zig14
1 files changed, 10 insertions, 4 deletions
diff --git a/std/math/trunc.zig b/std/math/trunc.zig
index 9449d0e7eb..219bcd4914 100644
--- a/std/math/trunc.zig
+++ b/std/math/trunc.zig
@@ -1,14 +1,20 @@
-// Special Cases:
+// Ported from musl, which is licensed under the MIT license:
+// https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
//
-// - trunc(+-0) = +-0
-// - trunc(+-inf) = +-inf
-// - trunc(nan) = nan
+// https://git.musl-libc.org/cgit/musl/tree/src/math/truncf.c
+// https://git.musl-libc.org/cgit/musl/tree/src/math/trunc.c
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
const maxInt = std.math.maxInt;
+/// Returns the integer value of x.
+///
+/// Special Cases:
+/// - trunc(+-0) = +-0
+/// - trunc(+-inf) = +-inf
+/// - trunc(nan) = nan
pub fn trunc(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {