zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit f9a9e8ba7375a6e4c7e9fa50902a897387212dbb (tree)
parent e46c61250332e615afc5aed6e4ebe57b8e6713eb
Author: viri <hi@viri.moe>
Date:   Fri,  8 Apr 2022 20:13:30 -0600

std.math.isInf: add tests for +-NaN

Diffstat:
Mlib/std/math/isinf.zig | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/std/math/isinf.zig b/lib/std/math/isinf.zig @@ -32,6 +32,8 @@ test "math.isInf" { try expect(!isInf(@as(T, -0.0))); try expect(isInf(math.inf(T))); try expect(isInf(-math.inf(T))); + try expect(!isInf(math.nan(T))); + try expect(!isInf(-math.nan(T))); } } @@ -44,6 +46,8 @@ test "math.isPositiveInf" { try expect(!isPositiveInf(@as(T, -0.0))); try expect(isPositiveInf(math.inf(T))); try expect(!isPositiveInf(-math.inf(T))); + try expect(!isInf(math.nan(T))); + try expect(!isInf(-math.nan(T))); } } @@ -56,5 +60,7 @@ test "math.isNegativeInf" { try expect(!isNegativeInf(@as(T, -0.0))); try expect(!isNegativeInf(math.inf(T))); try expect(isNegativeInf(-math.inf(T))); + try expect(!isInf(math.nan(T))); + try expect(!isInf(-math.nan(T))); } }