6 ms·
Raku interprets decimal literals (like 0.1) as limited-precision rational numbers (Rats) [0-1]. I think this is a pretty user-friendly compromise. [0] https:/
by jwmerrill 4y ago
Raku interprets decimal literals (like 0.1) as limited-precision rational numbers (Rats) [0-1].
I think this is a pretty user-friendly compromise.
[0] https://docs.raku.org/syntax/Number%20literals https://docs.raku.org/syntax/Number%20literals
[1] https://docs.raku.org/type/Rat https://docs.raku.org/type/Rat
- lizmat 4y agoActually, the limited precision is the default (caused by the numerator as well as the denominator having to fit in a 64-bit integer). By default, when it not longer fits, it will convert to floating point (called Num in Raku). But this behaviour can be set: another alternative is for the numerator and denominator both being big integers. This gives you infinite precision rational numbers, at the expense of potentially needing infinite CPU and/or RAM.