mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Merge pull request #7131 from nathanKramer/update-intcast-docs
Add Num.intCast documentation
This commit is contained in:
commit
609620da2e
1 changed files with 17 additions and 0 deletions
|
@ -548,6 +548,23 @@ tau = 2 * pi
|
|||
## [F64] or [F32] value, the returned string will be `"NaN"`, `"∞"`, or `"-∞"`.
|
||||
##
|
||||
toStr : Num * -> Str
|
||||
|
||||
## Convert an [Int] to a new [Int] of the expected type:
|
||||
##
|
||||
## ```roc
|
||||
## # Casts a U8 to a U16
|
||||
## x : U16
|
||||
## x = Num.intCast 255u8
|
||||
## ```
|
||||
##
|
||||
## In the case of downsizing, information is lost:
|
||||
##
|
||||
## ```roc
|
||||
## # returns 0, as the bits were truncated.
|
||||
## x : U8
|
||||
## x = Num.intCast 256u16
|
||||
## ```
|
||||
##
|
||||
intCast : Int a -> Int b
|
||||
|
||||
compare : Num a, Num a -> [LT, EQ, GT]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue