mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Merge pull request #2354 from rtfeldman/add_builtin_Num.minI128
Add `Num.minI128` builtin
This commit is contained in:
commit
2ade76b373
6 changed files with 80 additions and 0 deletions
|
|
@ -65,6 +65,7 @@ interface Num
|
|||
maxI128,
|
||||
maxInt,
|
||||
minFloat,
|
||||
minI128,
|
||||
minInt,
|
||||
modInt,
|
||||
modFloat,
|
||||
|
|
@ -822,6 +823,25 @@ maxU32 : U32
|
|||
## and zero is the lowest unsigned number. Unsigned numbers cannot be negative.
|
||||
minU32 : U32
|
||||
|
||||
## The highest number that can be stored in an #I128 without overflowing its
|
||||
## available memory and crashing.
|
||||
##
|
||||
## For reference, this number is `170_141_183_460_469_231_731_687_303_715_884_105_727`,
|
||||
## which is over 2 million.
|
||||
##
|
||||
## Note that this is smaller than the positive version of #Int.minI128,
|
||||
## which means if you call #Num.abs on #Int.minI128, it will overflow and crash!
|
||||
maxI128 : I128
|
||||
|
||||
## The min number that can be stored in an #I128 without underflowing its
|
||||
## available memory and crashing.
|
||||
##
|
||||
## For reference, this number is `-170_141_183_460_469_231_731_687_303_715_884_105_728`.
|
||||
##
|
||||
## Note that the positive version of this number is larger than #Int.maxI128,
|
||||
## which means if you call #Num.abs on #Int.minI128, it will overflow and crash!
|
||||
minI128 : I128
|
||||
|
||||
## The highest supported #F64 value you can have, which is approximately 1.8 × 10^308.
|
||||
##
|
||||
## If you go higher than this, your running Roc code will crash - so be careful not to!
|
||||
|
|
|
|||
|
|
@ -397,6 +397,9 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
Box::new(bool_type()),
|
||||
);
|
||||
|
||||
// minI128 : I128
|
||||
add_type!(Symbol::NUM_MIN_I128, i128_type());
|
||||
|
||||
// maxI128 : I128
|
||||
add_type!(Symbol::NUM_MAX_I128, i128_type());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue