diff options
author | inoas <mail@inoas.com> | 2022-04-12 20:31:17 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-04-16 10:23:34 +0100 |
commit | ceb1caf3d6f765b1cc4133679de1075437314fa3 (patch) | |
tree | 68b13997bc9c58f9cd99c3bc3231f1ac782effeb /src | |
parent | 0be9d80b95b8bf378021ef6fd441b31cb6fdabec (diff) | |
download | gleam_stdlib-ceb1caf3d6f765b1cc4133679de1075437314fa3.tar.gz gleam_stdlib-ceb1caf3d6f765b1cc4133679de1075437314fa3.zip |
refactor, cleanup
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() } |