aboutsummaryrefslogtreecommitdiff
path: root/std/math/nan.zig
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2018-06-30 01:44:54 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2018-06-30 01:58:17 +0200
commit27b02413dc3dacc7d784fe84ff8ba6cb0361842d (patch)
treea48f969278184b262aaae0005583bc182bea45b6 /std/math/nan.zig
parent61df5bc142253b0d33b77bceecfaef4c767e7feb (diff)
downloadzig-27b02413dc3dacc7d784fe84ff8ba6cb0361842d.tar.gz
zig-27b02413dc3dacc7d784fe84ff8ba6cb0361842d.zip
add std.math f16 nan support
refs #1122
Diffstat (limited to 'std/math/nan.zig')
-rw-r--r--std/math/nan.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/std/math/nan.zig b/std/math/nan.zig
index 22461711d0..2cbcbee81b 100644
--- a/std/math/nan.zig
+++ b/std/math/nan.zig
@@ -2,6 +2,7 @@ const math = @import("index.zig");
pub fn nan(comptime T: type) T {
return switch (T) {
+ f16 => @bitCast(f16, math.nan_u16),
f32 => @bitCast(f32, math.nan_u32),
f64 => @bitCast(f64, math.nan_u64),
else => @compileError("nan not implemented for " ++ @typeName(T)),
@@ -12,6 +13,7 @@ pub fn nan(comptime T: type) T {
// representation in the future when required.
pub fn snan(comptime T: type) T {
return switch (T) {
+ f16 => @bitCast(f16, math.nan_u16),
f32 => @bitCast(f32, math.nan_u32),
f64 => @bitCast(f64, math.nan_u64),
else => @compileError("snan not implemented for " ++ @typeName(T)),