Crate fixed_trigonometry
source · [−]Expand description
No-STD fixed-point numeric implementation of trigonometric functions in Rust.
It utilizes the fixed library to allow flexibility in fixed point sizes and precisions.
The library mixed-num has these functions implemented as traits.
The library NDSP support fixed point numbers in vectors, with various implemented operations.
Example
use fixed_trigonometry::*;
use fixed::{types::extra::U28, FixedI32};
let arg = atan::atan( FixedI32::<U28>::from_num(0.6)/FixedI32::<U28>::from_num(0.4) );
assert_eq!{ arg.to_num::<f32>(), 0.9782037 };
Modules
Functions
Calculate cosine using a Taylor approximation of cos(x)
.
Rase fixed number to an integer-valued power.
base^power
.
Get the sign of the argument with a unit value. Zero is of positive sign.
Calculate sin(x) using a Taylor approximation of sin(x)
.
Wrapps θ to the -π=<x<π range.