mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
parent
2faa0e4c5b
commit
ec94fc87a5
3 changed files with 56 additions and 0 deletions
|
@ -39,6 +39,8 @@ interface Num
|
|||
add,
|
||||
sub,
|
||||
mul,
|
||||
min,
|
||||
max,
|
||||
isLt,
|
||||
isLte,
|
||||
isGt,
|
||||
|
@ -777,6 +779,34 @@ sub : Num a, Num a -> Num a
|
|||
## ∞ or -∞. For all other number types, overflow results in a panic.
|
||||
mul : Num a, Num a -> Num a
|
||||
|
||||
## Obtains the smaller between two numbers of the same type.
|
||||
##
|
||||
## ```
|
||||
## Num.min 100 0
|
||||
##
|
||||
## Num.min 3.0 -3.0
|
||||
## ```
|
||||
min : Num a, Num a -> Num a
|
||||
min = \a, b ->
|
||||
if a < b then
|
||||
a
|
||||
else
|
||||
b
|
||||
|
||||
## Obtains the greater between two numbers of the same type.
|
||||
##
|
||||
## ```
|
||||
## Num.max 100 0
|
||||
##
|
||||
## Num.max 3.0 -3.0
|
||||
## ```
|
||||
max : Num a, Num a -> Num a
|
||||
max = \a, b ->
|
||||
if a > b then
|
||||
a
|
||||
else
|
||||
b
|
||||
|
||||
sin : Frac a -> Frac a
|
||||
cos : Frac a -> Frac a
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue