2017-06-16 09:26:10 +01:00
|
|
|
const math = @import("index.zig");
|
|
|
|
|
2018-01-25 09:10:11 +00:00
|
|
|
pub fn nan(comptime T: type) T {
|
2017-12-22 05:50:30 +00:00
|
|
|
return switch (T) {
|
2017-06-16 09:26:10 +01:00
|
|
|
f32 => @bitCast(f32, math.nan_u32),
|
|
|
|
f64 => @bitCast(f64, math.nan_u64),
|
|
|
|
else => @compileError("nan not implemented for " ++ @typeName(T)),
|
2017-12-22 05:50:30 +00:00
|
|
|
};
|
2017-06-16 09:26:10 +01:00
|
|
|
}
|
2017-06-20 12:01:04 +01:00
|
|
|
|
|
|
|
// Note: A signalling nan is identical to a standard right now by may have a different bit
|
|
|
|
// representation in the future when required.
|
2018-01-25 09:10:11 +00:00
|
|
|
pub fn snan(comptime T: type) T {
|
2017-12-22 05:50:30 +00:00
|
|
|
return switch (T) {
|
2017-06-20 12:01:04 +01:00
|
|
|
f32 => @bitCast(f32, math.nan_u32),
|
|
|
|
f64 => @bitCast(f64, math.nan_u64),
|
|
|
|
else => @compileError("snan not implemented for " ++ @typeName(T)),
|
2017-12-22 05:50:30 +00:00
|
|
|
};
|
2017-06-20 12:01:04 +01:00
|
|
|
}
|