diff options
Diffstat (limited to 'v_windows/v/vlib/math/abs.v')
-rw-r--r-- | v_windows/v/vlib/math/abs.v | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/v_windows/v/vlib/math/abs.v b/v_windows/v/vlib/math/abs.v new file mode 100644 index 0000000..55bcff2 --- /dev/null +++ b/v_windows/v/vlib/math/abs.v @@ -0,0 +1,18 @@ +module math + +// Returns the absolute value. +[inline] +pub fn abs(x f64) f64 { + if x > 0.0 { + return x + } + return -x +} + +[inline] +pub fn fabs(x f64) f64 { + if x > 0.0 { + return x + } + return -x +} |