pub fn atan2(value: f64, other: f64) -> f64
Expand description
Computes the four quadrant arctangent of value
(y
) and other
(x
) in
radians.
Return value is a angle in radians between the positive x-axis of Cartesian
plane and the point given by the coordinates (x
, y
) on it.
Domain: (-INFINITY, INFINITY)
Codomain: [-PI, PI]
ยงExamples
use spinoso_math as math;
assert!((math::atan2(-0.0, -1.0) - (-3.141592653589793)).abs() < f64::EPSILON);
assert!((math::atan2(-1.0, -1.0) - (-2.356194490192345)).abs() < f64::EPSILON);
assert!((math::atan2(-1.0, 0.0) - (-1.5707963267948966)).abs() < f64::EPSILON);
assert!((math::atan2(-1.0, 1.0) - (-0.7853981633974483)).abs() < f64::EPSILON);
assert!(math::atan2(-0.0, 1.0) == -0.0);
assert!(math::atan2(0.0, 1.0) == 0.0);
assert!((math::atan2(1.0, 1.0) - 0.7853981633974483).abs() < f64::EPSILON);
assert!((math::atan2(1.0, 0.0) - 1.5707963267948966).abs() < f64::EPSILON);
assert!((math::atan2(1.0, -1.0) - 2.356194490192345).abs() < f64::EPSILON);
assert!((math::atan2(0.0, -1.0) - 3.141592653589793).abs() < f64::EPSILON);
assert!((math::atan2(f64::INFINITY, f64::INFINITY) - 0.7853981633974483).abs() < f64::EPSILON);
assert!(
(math::atan2(f64::INFINITY, f64::NEG_INFINITY) - 2.356194490192345).abs() < f64::EPSILON
);
assert!(
(math::atan2(f64::NEG_INFINITY, f64::INFINITY) - (-0.7853981633974483)).abs()
< f64::EPSILON
);
assert!(
(math::atan2(f64::NEG_INFINITY, f64::NEG_INFINITY) - (-2.356194490192345)).abs()
< f64::EPSILON
);