aboutsummaryrefslogtreecommitdiff
path: root/gen/src
diff options
context:
space:
mode:
authorBrett Snyder <bsnyder@digitalocean.com>2019-10-03 08:57:15 -0500
committerLouis Pilfold <louis@lpil.uk>2019-10-03 14:57:15 +0100
commit81b3ca2b9b3dceedd62fbcef741548ae8a513601 (patch)
tree6ebb7827be9d5974f70cc94d44ddb2be70b607a3 /gen/src
parentcc7ba56105a6f8933c2bfd25151061a94471eb23 (diff)
downloadgleam_stdlib-81b3ca2b9b3dceedd62fbcef741548ae8a513601.tar.gz
gleam_stdlib-81b3ca2b9b3dceedd62fbcef741548ae8a513601.zip
add max() for Int and Float (#266)
Diffstat (limited to 'gen/src')
-rw-r--r--gen/src/gleam@float.erl11
-rw-r--r--gen/src/gleam@int.erl11
2 files changed, 20 insertions, 2 deletions
diff --git a/gen/src/gleam@float.erl b/gen/src/gleam@float.erl
index 625ba56..7eb18cf 100644
--- a/gen/src/gleam@float.erl
+++ b/gen/src/gleam@float.erl
@@ -1,7 +1,7 @@
-module(gleam@float).
-compile(no_auto_import).
--export([parse/1, to_string/1, compare/2, min/2, ceiling/1, floor/1, round/1, truncate/1]).
+-export([parse/1, to_string/1, compare/2, min/2, max/2, ceiling/1, floor/1, round/1, truncate/1]).
parse(A) ->
gleam_stdlib:parse_float(A).
@@ -33,6 +33,15 @@ min(A, B) ->
B
end.
+max(A, B) ->
+ case A > B of
+ true ->
+ A;
+
+ false ->
+ B
+ end.
+
ceiling(A) ->
math:ceil(A).
diff --git a/gen/src/gleam@int.erl b/gen/src/gleam@int.erl
index de9ce8b..1449d09 100644
--- a/gen/src/gleam@int.erl
+++ b/gen/src/gleam@int.erl
@@ -1,7 +1,7 @@
-module(gleam@int).
-compile(no_auto_import).
--export([parse/1, to_string/1, to_base_string/2, compare/2, min/2]).
+-export([parse/1, to_string/1, to_base_string/2, compare/2, min/2, max/2]).
parse(A) ->
gleam_stdlib:parse_int(A).
@@ -35,3 +35,12 @@ min(A, B) ->
false ->
B
end.
+
+max(A, B) ->
+ case A > B of
+ true ->
+ A;
+
+ false ->
+ B
+ end.