2 releases

0.1.1 Oct 14, 2024
0.1.0 Sep 17, 2024

#242 in Math

Download history 148/week @ 2024-09-17 8/week @ 2024-09-24 8/week @ 2024-10-01 113/week @ 2024-10-08 66/week @ 2024-10-15 2/week @ 2024-10-29 4/week @ 2024-11-05

185 downloads per month

MIT/Apache

325KB
8K SLoC

fpmath

GitHub Actions Status crates.io Documentation MSRV License

fpmath is a pure-Rust floating point library that implements math functions for f32 and f64.

Features

  • Less than 1 ULP error in most functions.
  • f32 versions do not internally use f64 arithmetic.
  • All functions are also implemented for soft-float single-precision and double precision.
  • no_std
  • All functions are tested for accuracy (MPFR is used to calculate reference values).
  • The included generator crate can generate all magic constants used in the algorithms.

Included functions

  • Absolute value
  • Copy sign
  • Rounding (to nearest, towards zero, towards infinity, towards negative infinity)
  • Exponential in base e, 2 and 10
  • Logarithm in base e, 2 and 10
  • Trigonometric (sine, cosine, tangent) in radians, degrees and half-revolutions
  • Inverse trigonometric (arcsine, arccosine, arctangent) in radians, degrees and half-revolutions
  • Hyperbolic (sine, cosine, tangent)
  • Inverse hyperbolic (arcsine, arccosine, arctangent)
  • Square and cube root
  • Hypotenuse
  • Power (floating point and integer exponent)

License

Licensed under either of

at your option.

Dependencies