diff options
| author | Marc Tiehuis <marctiehuis@gmail.com> | 2019-05-01 18:15:57 +1200 |
|---|---|---|
| committer | Marc Tiehuis <marctiehuis@gmail.com> | 2019-05-01 18:37:46 +1200 |
| commit | 89d71a960b0f90335fded84a449a84806bb6f661 (patch) | |
| tree | efbb720dbdd17ad782233c958f11d2f584d662c4 /std/math/log.zig | |
| parent | f94964cd057ace39caa05c10d9626ac6a4beb23b (diff) | |
| download | zig-89d71a960b0f90335fded84a449a84806bb6f661.tar.gz zig-89d71a960b0f90335fded84a449a84806bb6f661.zip | |
std.math: Add documentation for all functions and algorithm sources
Diffstat (limited to 'std/math/log.zig')
| -rw-r--r-- | std/math/log.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/std/math/log.zig b/std/math/log.zig index 100dc2fb7f..77f3639fd2 100644 --- a/std/math/log.zig +++ b/std/math/log.zig @@ -1,9 +1,16 @@ +// Ported from musl, which is licensed under the MIT license: +// https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT +// +// https://git.musl-libc.org/cgit/musl/tree/src/math/logf.c +// https://git.musl-libc.org/cgit/musl/tree/src/math/log.c + const std = @import("../std.zig"); const math = std.math; const builtin = @import("builtin"); const TypeId = builtin.TypeId; const expect = std.testing.expect; +/// Returns the logarithm of x for the provided base. pub fn log(comptime T: type, base: T, x: T) T { if (base == 2) { return math.log2(x); |
