2 releases

Uses old Rust 2015

0.1.1 Jan 13, 2019
0.1.0 May 10, 2015

#678 in Algorithms

Download history 17443/week @ 2024-01-10 21526/week @ 2024-01-17 17895/week @ 2024-01-24 17780/week @ 2024-01-31 17313/week @ 2024-02-07 18126/week @ 2024-02-14 18218/week @ 2024-02-21 18685/week @ 2024-02-28 20484/week @ 2024-03-06 19960/week @ 2024-03-13 21547/week @ 2024-03-20 21730/week @ 2024-03-27 25006/week @ 2024-04-03 29953/week @ 2024-04-10 27884/week @ 2024-04-17 21624/week @ 2024-04-24

109,334 downloads per month
Used in 102 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