diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/float.gleam | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam index 5aeec4f..42a7b7b 100644 --- a/src/gleam/float.gleam +++ b/src/gleam/float.gleam @@ -230,8 +230,16 @@ pub fn absolute_value(float: Float) -> Float { /// Returns the absolute distance of the inputs as a positive Float /// +/// ## Examples +/// +/// > distance(-10.0, 10.0) +/// 20.0 +/// +/// > distance(0.0, -2.0) +/// 2.0 +/// pub fn distance(a: Float, b: Float) -> Float { - absolute_value(a) -. absolute_value(b) + a -. b |> absolute_value() } |