math: allow `acos(0)` (fix #13876) (#13877)

pull/13884/head
kylepritchard 2022-03-30 19:36:50 +01:00 committed by GitHub
parent ae1cb5697e
commit 6137ce23c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 3 deletions

View File

@ -206,9 +206,6 @@ pub fn acos(x f64) f64 {
if (x < -1.0) || (x > 1.0) { if (x < -1.0) || (x > 1.0) {
return nan() return nan()
} }
if x == 0.0 {
return nan()
}
if x > 0.5 { if x > 0.5 {
return f64(2.0) * asin(sqrt(0.5 - 0.5 * x)) return f64(2.0) * asin(sqrt(0.5 - 0.5 * x))
} }