Add Num.intCast documentation

Have added GPG signing to the commit
This commit is contained in:
Nathan Kramer 2024-09-29 18:10:41 +10:00
parent 587d0afd46
commit bc1023065c
No known key found for this signature in database
GPG key ID: F067E9F18E762681

View file

@ -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]