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

math: fix error for math.abs(0.0)/math.abs(0) (related #14165) (#14191)

This commit is contained in:
yuyi
2022-04-27 18:23:37 +08:00
committed by GitHub
parent 752e105f25
commit 82ac39eca6
2 changed files with 11 additions and 1 deletions

View File

@ -18,5 +18,5 @@ pub fn max<T>(a T, b T) T {
// abs returns the absolute value of `a`
[inline]
pub fn abs<T>(a T) T {
return if a > 0 { a } else { -a }
return if a < 0 { -a } else { a }
}