Crate wasmtime_math

Source
Expand description

A minimal helper crate for implementing float-related operations for WebAssembly in terms of the native platform primitives.

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 the libm fallback.
  • Behavior of f32::trunc differs across platforms, for example it’s different on Windows and glibc on Linux. Additionally riscv64’s implementation of libm 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§

WasmFloat