From 2cbcf3f38bb32752b449ce72a8d8f978e65008f8 Mon Sep 17 00:00:00 2001 From: Matthew Murray Date: Thu, 20 Jun 2019 14:36:34 +0100 Subject: Fix absFloat --- std/math.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'std/math.zig') diff --git a/std/math.zig b/std/math.zig index 96f38aca9f..ac06a07953 100644 --- a/std/math.zig +++ b/std/math.zig @@ -482,7 +482,16 @@ fn testAbsInt() void { testing.expect((absInt(i32(10)) catch unreachable) == 10); } -pub const absFloat = @import("fabs.zig").fabs; +pub const absFloat = fabs; + +test "math.absFloat" { + testAbsFloat(); + comptime testAbsFloat(); +} +fn testAbsFloat() void { + testing.expect(absFloat(f32(-10.05)) == 10.05); + testing.expect(absFloat(f32(10.05)) == 10.05); +} pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T { @setRuntimeSafety(false); -- cgit v1.2.3