2017-06-16 01:26:10 -07:00
|
|
|
const math = @import("index.zig");
|
|
|
|
|
2018-01-25 01:10:11 -08:00
|
|
|
pub fn nan(comptime T: type) T {
|
2017-12-21 21:50:30 -08:00
|
|
|
return switch (T) {
|
2017-06-16 01:26:10 -07:00
|
|
|
f32 => @bitCast(f32, math.nan_u32),
|
|
|
|
f64 => @bitCast(f64, math.nan_u64),
|
|
|
|
else => @compileError("nan not implemented for " ++ @typeName(T)),
|
2017-12-21 21:50:30 -08:00
|
|
|
};
|
2017-06-16 01:26:10 -07:00
|
|
|
}
|
2017-06-20 04:01:04 -07: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 01:10:11 -08:00
|
|
|
pub fn snan(comptime T: type) T {
|
2017-12-21 21:50:30 -08:00
|
|
|
return switch (T) {
|
2017-06-20 04:01:04 -07:00
|
|
|
f32 => @bitCast(f32, math.nan_u32),
|
|
|
|
f64 => @bitCast(f64, math.nan_u64),
|
|
|
|
else => @compileError("snan not implemented for " ++ @typeName(T)),
|
2017-12-21 21:50:30 -08:00
|
|
|
};
|
2017-06-20 04:01:04 -07:00
|
|
|
}
|