2 releases

Uses old Rust 2015

0.1.1 Jan 13, 2019
0.1.0 May 10, 2015

#759 in Algorithms

Download history 21087/week @ 2024-07-22 22455/week @ 2024-07-29 22341/week @ 2024-08-05 21667/week @ 2024-08-12 22314/week @ 2024-08-19 23662/week @ 2024-08-26 20839/week @ 2024-09-02 22610/week @ 2024-09-09 11830/week @ 2024-09-16 18383/week @ 2024-09-23 18218/week @ 2024-09-30 19491/week @ 2024-10-07 25200/week @ 2024-10-14 27150/week @ 2024-10-21 27053/week @ 2024-10-28 30478/week @ 2024-11-04

110,792 downloads per month
Used in 112 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