Module nanowasm::util [] [src]

Misc numerical stuff and other handy functions.

Functions

copysign

fcopysign:

f32_is_signaling_nan

Returns whether or not the float is a signaling NaN. A signaling NaN has a format like: s111 1111 1nxx xxxx xxxx xxxx xxxx xxxx where the x's represent a non-zero number (zero would be infinity) and n is 0. The sign bit s may be anything.

f64_is_signaling_nan

Same as f32_is_signaling_nan() for f64's. The signaling-nan-bit is bit 51 instead of bit 22

round_to_int

Rounds the float into the given integer type.

truncate_to_int

Truncates the float into the given integer type.

u32_to_f32

A convenience function for doing a bitwise conversion of a u32 to an f32. We don't just use f32::from_bits() so that we can insert extra checking to filter out signaling NaN's, which are disallowed by wasm.

u64_to_f64

A convenience function for doing a bitwise conversion of a u64 to an f64 We don't just use f64::from_bits() so that we can insert extra checking to filter out signaling NaN's, which are disallowed by wasm.