Merge rust-lang/libm#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 rust-lang/libm#9 Co-authored-by: Joseph Ryan <josephryan3.14@gmail.com>
This commit is contained in:
commit
89c7f41c04
1 changed files with 10 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue