2 releases

Uses old Rust 2015

0.1.1 Jan 13, 2019
0.1.0 May 10, 2015

#1346 in Math

Download history 17548/week @ 2023-11-07 19745/week @ 2023-11-14 11608/week @ 2023-11-21 17519/week @ 2023-11-28 17338/week @ 2023-12-05 17751/week @ 2023-12-12 16789/week @ 2023-12-19 10438/week @ 2023-12-26 18059/week @ 2024-01-02 18936/week @ 2024-01-09 19907/week @ 2024-01-16 19957/week @ 2024-01-23 16330/week @ 2024-01-30 18298/week @ 2024-02-06 16407/week @ 2024-02-13 17187/week @ 2024-02-20

70,753 downloads per month
Used in 95 crates (12 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