diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/float.gleam | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam index f810161..c85903f 100644 --- a/src/gleam/float.gleam +++ b/src/gleam/float.gleam @@ -115,3 +115,16 @@ pub external fn round(Float) -> Int = /// pub external fn truncate(Float) -> Int = "erlang" "trunc" + +/// Returns the absolute value of the input as a float. +/// +/// ## Examples +/// +/// > absolute_value(-12.5) +/// 12.5 +/// +/// > absolute_value(10.2) +/// 10.2 +/// +pub external fn absolute_value(Float) -> Float = + "erlang" "abs" |