#wasmtime #low-level #routines #math #platform #trunc

no-std wasmtime-math

Low-level math routines used in Wasmtime

5 stable releases

new 30.0.2 Feb 25, 2025
30.0.1 Feb 21, 2025
30.0.0 Feb 20, 2025
29.0.1 Jan 21, 2025
29.0.0 Jan 20, 2025

#935 in WebAssembly

Download history 4188/week @ 2025-01-17 10869/week @ 2025-01-24 13567/week @ 2025-01-31 17315/week @ 2025-02-07 7519/week @ 2025-02-14

51,179 downloads per month
Used in 66 crates (2 directly)

Apache-2.0 WITH LLVM-exception

11KB
251 lines

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.

Dependencies

~395KB