2 releases

Uses old Rust 2015

0.1.1 Jan 13, 2019
0.1.0 May 10, 2015

#524 in Algorithms

Download history 25434/week @ 2024-06-22 39948/week @ 2024-06-29 26849/week @ 2024-07-06 17828/week @ 2024-07-13 21110/week @ 2024-07-20 22371/week @ 2024-07-27 22895/week @ 2024-08-03 21635/week @ 2024-08-10 21828/week @ 2024-08-17 24367/week @ 2024-08-24 19694/week @ 2024-08-31 22940/week @ 2024-09-07 13181/week @ 2024-09-14 17142/week @ 2024-09-21 18144/week @ 2024-09-28 16646/week @ 2024-10-05

68,718 downloads per month
Used in 110 crates (14 directly)

MIT/Apache

21KB
422 lines

fast-math

Build Status codecov

Fast, approximate versions of mathematical functions. Includes:

  • Logarithms: log2,
  • Exponentials: exp, exp2,
  • Trigonometric functions: atan, atan2.

Documentation, crates.io.


lib.rs:

Fast, approximate versions of mathematical functions.

This crate includes implementations of "expensive" mathematical functions that are much faster, at the expense of some accuracy. All functions have good guarantees on accuracy to some degree (both relative and absolute).

Installation

Add this to your Cargo.toml

[dependencies]
fast-math = "0.1"

Examples

let x = 10.4781;
let approx = fast_math::log2(x);
let real = x.log2();
// they should be close
assert!((approx - real).abs() < 0.01);

Dependencies

~75KB