Skip to main content

f32_cvt_to_int_bounds

Function f32_cvt_to_int_bounds 

Source
pub const fn f32_cvt_to_int_bounds(signed: bool, out_bits: u32) -> (f32, f32)
Expand description

Returns the bounds for guarding a trapping f32-to-int conversion.

This function will return two floats, a lower bound and an upper bound, which can be used to test whether a WebAssembly f32-to-int conversion should trap. The float being converted must be greater than the lower bound and less than the upper bound for the conversion to proceed, otherwise a trap or infinity value should be generated.

The signed argument indicates whether a conversion to a signed integer is happening. If false a conversion to an unsigned integer is happening. The out_bits argument indicates how many bits are in the integer being converted to.