Expand description
Complete set of trigonometric and hyperbolic functions in Rust.
§Summary
This crate defines the Trig trait defining the complete set of trigonometric and hyperbolic
functions. Rust already provides the following functions for f32s and f64s:
- trigonometric functions (radians):
sin,cos,tan - inverse trigonometric functions (radians):
asin,acos,atan,atan2 - hyperbolic functions:
sinh,cosh,tanh - inverse hyperbolic functions:
asinh,acosh,atanh
In addition to these functions, the Trig trait also defines the reciprocal functions and
their inverses for both the trigonometric and hyperbolic functions. The complete set of methods
defined on the Trig trait is:
- trigonometric functions (radians):
sin,cos,tan,csc,sec,cot - inverse trigonometric functions (radians):
asin,acos,atan,acsc,asec,acot - trigonometric functions (degrees):
sind,cosd,tand,cscd,secd,cotd - inverse trigonometric functions (degrees):
asind,acosd,atand,atan2d,acscd,asecd,acotd - hyperbolic functions:
sinh,cosh,tanh,csch,sech,coth - inverse hyperbolic functions:
asinh,acosh,atanh,acsch,asech,acoth - unit conversions:
deg2rad,rad2deg
§Implementations
This crate currently implements the Trig trait for the following types/structs:
§Example
use trig::Trig;
let x = std::f64::consts::FRAC_PI_2;
let abs_difference = (x.csc() - 1.0).abs();
assert!(abs_difference < 1e-16);Traits§
- Trig
- Trigonometric functions.