|
|
|
|
|
by OskarS
1896 days ago
|
|
Not in Raku it doesn't! > 1.1 + 2.2
3.3
> 1.1 + 2.2 == 3.3
True
EDIT: to be clear: this is not because Raku is magic, it's because Raku defaults to a rational number type for decimal literals, which is arguably a much better choice for a language like Raku. |
|
Meanwhile, in Rakudo, 0.1 is a Rat: a rational number where the numerator and denominator are computed.
You can actually get the same underlying behavior in Common Lisp:
Sadly, not many recent languages have defaults as nice as those. Another example is Julia: IMO, numerical computations should be correct by default, and fast in opt-in.