math: fix abs (-0.0)

pull/3099/head
Kaito Sugimoto 2019-12-16 01:37:17 +09:00 committed by Alexander Medvednikov
parent faa04c586f
commit 9dd86a2de6
1 changed files with 2 additions and 4 deletions

View File

@ -18,6 +18,7 @@ fn C.erf(x f64) f64
fn C.erfc(x f64) f64
fn C.exp(x f64) f64
fn C.exp2(x f64) f64
fn C.fabs(x f64) f64
fn C.floor(x f64) f64
fn C.fmod(x f64, y f64) f64
fn C.hypot(x f64, y f64) f64
@ -42,10 +43,7 @@ fn C.trunc(x f64) f64
// Returns the absolute value.
pub fn abs(a f64) f64 {
if a < 0 {
return -a
}
return a
return C.fabs(a)
}
// acos calculates inverse cosine (arccosine).