Merge #122
122: Add sanity_check for atan2 r=japaric a=P1n3appl3 It's already been merged, but now I can say with certainty that this closes #9 Co-authored-by: Joseph Ryan <josephryan3.14@gmail.com>
This commit is contained in:
@@ -70,3 +70,13 @@ pub fn atan2(y: f64, x: f64) -> f64 {
|
||||
_ => (z - PI_LO) - PI, /* atan(-,-) */
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sanity_check() {
|
||||
assert_eq!(atan2(0.0, 1.0), 0.0);
|
||||
assert_eq!(atan2(0.0, -1.0), PI);
|
||||
assert_eq!(atan2(-0.0, -1.0), -PI);
|
||||
assert_eq!(atan2(3.0, 2.0), atan(3.0 / 2.0));
|
||||
assert_eq!(atan2(2.0, -1.0), atan(2.0 / -1.0) + PI);
|
||||
assert_eq!(atan2(-2.0, -1.0), atan(-2.0 / -1.0) - PI);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user