1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

math: fix abs (-0.0)

This commit is contained in:
Kaito Sugimoto 2019-12-16 01:37:17 +09:00 committed by Alexander Medvednikov
parent faa04c586f
commit 9dd86a2de6

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).