trig-const
Rust implementation of const trig functions.
This is implemens trig functions using Taylor series approximations. Correctness is prioritized over speed, especially considering the main use case for this crate is to expose trigonometric functions for compile-time evaluation.
The implemntation was largely inspired by the work of Dr. Austin Henley and Dr. Stephen Marz:
- GitHub Repo: https://github.com/AZHenley/cosine
- Article: https://austinhenley.com/blog/cosine.html
The implementation carries forward the original MIT license contained in the GitHub repo above.
Project Goals
- Correctness while const (same result as std within a rounding error)
- no-std
- No unsafe
Requirements
This crate supports any compiler version back to rustc 1.85.0
[dependencies]
trig-const = "0"
Example
const COS_PI: f64 = cos;
assert_eq!;
use PI;
use ;
const SIN_PI_4: f64 = sin;
const ATAN2_0_0: f64 = atan2;
Functions
- acos
- acosh
- asin
- asinh
- atan
- atan2
- cos
- cosh
- cot
- csc
- sec
- sin
- sinh
- tan