[][src]Crate fast_math

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);

Functions

atan

Compute a fast approximation of the arctangent of x.

atan2

Compute a fast approximation of the four quadrant arctangent of y and x.

atan_raw

Compute a fast approximation of the inverse tangent for |x| < 1.

exp

Compute a fast approximation to ex.

exp2_raw

Compute a fast approximation to 2x for -151 ≤ x ≤ 151.

exp2

Compute a fast approximation to 2x.

exp_raw

Compute a fast approximation to ex for -104 ≤ x ≤ 104.

log2

Compute a fast approximation of the base-2 logarithm of x.

log2_raw

Compute a fast approximation of the base-2 logarithm of positive, finite, non-denormal x.