fast_math/lib.rs
1//! Fast, approximate versions of mathematical functions.
2//!
3//! This crate includes implementations of "expensive" mathematical
4//! functions that are much faster, at the expense of some
5//! accuracy. All functions have good guarantees on accuracy to some
6//! degree (both relative and absolute).
7//!
8//! # Installation
9//!
10//! Add this to your Cargo.toml
11//!
12//! ```toml
13//! [dependencies]
14//! fast-math = "0.1"
15//! ```
16//!
17//! # Examples
18//!
19//! ```rust
20//! let x = 10.4781;
21//! let approx = fast_math::log2(x);
22//! let real = x.log2();
23//! // they should be close
24//! assert!((approx - real).abs() < 0.01);
25//! ```
26
27#![no_std]
28#[cfg(test)] extern crate quickcheck;
29#[cfg(test)] #[macro_use] extern crate std;
30extern crate ieee754;
31
32pub use log::{log2, log2_raw};
33pub use atan::{atan_raw, atan, atan2};
34pub use exp::{exp_raw, exp2_raw, exp, exp2};
35
36mod log;
37mod atan;
38mod exp;
39
40#[doc(hidden)]
41pub mod float;