When casting U32 to I64 I get a negative number.
Repro:
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
import pf.Stdout
main =
numU32 = 2865848396u32
numI64 = numU32 |> Num.toI64
Stdout.line! (Inspect.toStr numI64)
The results is:
-1429118900
When using the toInt64Checked
version, I get:
(Ok -1429118900)
Must be sign extending....interesting
Last updated: Jul 06 2025 at 12:14 UTC