#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

#929 in Math

Download history 17/week @ 2024-07-01 22/week @ 2024-07-29 14/week @ 2024-09-23 48/week @ 2024-09-30

62 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–2MB
~41K SLoC