#portable #predictable #strict #platform #results #fdlibm

rust-strictmath

Rust portable strict math implemention

3 releases

0.1.2 Nov 30, 2023
0.1.1 Nov 3, 2023
0.1.0 May 4, 2023

#917 in Math

40 downloads per month
Used in sketches-rust

Apache-2.0

260KB
5.5K SLoC

C 5K SLoC // 0.4% comments Rust 388 SLoC

rust-strictmath

This crate is inspired by java StrictMath. If obtaining a completely predictable result is more important than running speed, then the crate should be used.This crate provide series of float functions to ensure they could produce the same results across different platforms. These algorithms are available from the well-known network library, fdlibm.

functions

  • acos
  • asin
  • atan
  • atan2
  • cbrt
  • cos
  • cosh
  • exp
  • expm1
  • hypot
  • log
  • log10
  • log1p
  • pow
  • sin
  • sinh
  • sqrt
  • tan
  • tanh

usage

Run the following Cargo command in your project directory:

cargo add rust-strictmath

Or add the following line to your Cargo.toml:

rust-strictmath = "0.1.2"

No runtime deps

~0–2.1MB
~43K SLoC