rakudo / rakudo

🦋 Rakudo – Raku on MoarVM, JVM, and JS
https://rakudo.org/
Artistic License 2.0
1.73k stars 374 forks source link

1e0 / 0e0 should return Inf #2502

Open nwellnhof opened 5 years ago

nwellnhof commented 5 years ago

I'm seeing:

say 1e0 / 0e0  # Attempt to divide 1 by zero using /
say 1e0 % 0e0  # Attempt to divide 1 by zero using %

I'd expect to see Inf (as mandated by IEEE 754) and NaN (like POSIX fmod).

nwellnhof commented 5 years ago

I think that the DivideByZero failures in Num.p6 simply have to be removed.

zoffixznet commented 5 years ago

The current behaviour is part of 6.c specification, so the fix is more involved than simply removing those Failures. It has to be language-version based.

That was on 6.d roadmap, but is "blocked" by R#1289 and so was deferred until later language version. I use "blocked" in quotes because technically we can currently re-define these operators in 6.e.PREVIEW language already, but:

Thus, trying to make it work right now would at the very least be fragile and messy, so the hope is that once we figure out all the semantics to have R#1289 closed we will have figured out how to handle language-version control of these ops' behaviour as well.