Expand description
A minimal helper crate for implementing float-related operations for WebAssembly in terms of the native platform primitives.
⚠️ Warning ⚠️: this crate is an internal-only crate for the Wasmtime project and is not intended for general use. APIs are not strictly reviewed for safety and usage outside of Wasmtime may have bugs. If you’re interested in using this feel free to file an issue on the Wasmtime repository to start a discussion about doing so, but otherwise be aware that your usage of this crate is not supported.
This crate is intended to assist with solving the portability issues such as:
- Functions like
f32::trunc
are not available in#![no_std]
targets. - The
f32::trunc
function is likely faster than thelibm
fallback. - Behavior of
f32::trunc
differs across platforms, for example it’s different on Windows and glibc on Linux. Additionally riscv64’s implementation oflibm
seems to have different NaN behavior than other platforms. - Some wasm functions are in the Rust standard library, but not stable yet.
There are a few locations throughout the codebase that these functions are needed so they’re implemented only in a single location here rather than multiple.
Traits§
Functions§
- f32_
cvt_ to_ int_ bounds - Returns the bounds for guarding a trapping f32-to-int conversion.
- f64_
cvt_ to_ int_ bounds - Same as
f32_cvt_to_int_bounds
but used for f64-to-int conversions.