roc
roc copied to clipboard
Add Num.infinityF32 and F64, Num.nanF32 and F64
Currently there's no way to directly ask for infinity, -infinity, or NaN. There should be:
- [x] https://github.com/roc-lang/roc/pull/6711 Add builtins for
Num.infinityF32 : F32,Num.infinityF64 : F64,Num.nanF32 : F32, andNum.nanF64 : F64- at first, they can just be equal to expressions which evaluate to those (e.g.infinityF32 = 1 / 0,nanF64 = 0 / 0). - [ ] Make a separate issue to replace the
= 1 / 0implementations with compiler-generated numbers, since that will result in better runtime perf in dev builds. - [ ] Change the repl so that for infinity, we print out
Num.infinityF32orNum.infinityF64instead of∞and-∞today (useinfinityF64if the number's type isFrac *), and do the same fornan. For negative infinity, print out-Num.infinityF32or-Num.infinityF64. Relevant code is here; some tests will also need to be updated.