aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math/ln.zig
diff options
context:
space:
mode:
authorMichael Dusan <michael.dusan@gmail.com>2021-04-11 17:40:19 -0400
committerMichael Dusan <michael.dusan@gmail.com>2021-04-11 17:40:19 -0400
commit93cf9560b13619159efb3ca12eeeb13d6031ad85 (patch)
tree4b5857db65268b6e3a41fc436082da7b100647b6 /lib/std/math/ln.zig
parent86b31394c9d73b0f753918cea4f08ce8d7a26119 (diff)
parent82a31aac9b955213f47ff3b2a2c7eb932fdbe294 (diff)
downloadzig-93cf9560b13619159efb3ca12eeeb13d6031ad85.tar.gz
zig-93cf9560b13619159efb3ca12eeeb13d6031ad85.zip
Merge remote-tracking branch 'origin/master' into llvm12
Diffstat (limited to 'lib/std/math/ln.zig')
-rw-r--r--lib/std/math/ln.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/std/math/ln.zig b/lib/std/math/ln.zig
index e0ce32a7e1..ce7cb3d882 100644
--- a/lib/std/math/ln.zig
+++ b/lib/std/math/ln.zig
@@ -36,8 +36,9 @@ pub fn ln(x: anytype) @TypeOf(x) {
.ComptimeInt => {
return @as(comptime_int, math.floor(ln_64(@as(f64, x))));
},
- .Int => {
- return @as(T, math.floor(ln_64(@as(f64, x))));
+ .Int => |IntType| switch (IntType.signedness) {
+ .signed => return @compileError("ln not implemented for signed integers"),
+ .unsigned => return @as(T, math.floor(ln_64(@as(f64, x)))),
},
else => @compileError("ln not implemented for " ++ @typeName(T)),
}