Why not case it to switch it to 0x7fffffff? In any case, if the code's added in to check for it an to throw an exception, then wouldn't it be more friendly to return as close to what's expected, and just call it "magical rounding"? But out of curiosity, why would integer division be a floating point exception?

Oh, and on my iBook g3, I get -1.

On Feb 9, 2006, at 6:20 PM, Leopold Toetsch wrote:

Strange, but it exists for just on case (well not strange, there are just more negative numbers ...):

$ cat div.pasm
set I0, 0x80000000
div I1, I0, -1
print I1
print "\n"
end

Running it on PPC gives:

$ ./parrot div.pasm
0

And on x86:

$ ./parrot div.pasm
Floating point exception

What shall we do?
Abstract it like division by zero and throw an exception?
Just ignore it?

Comments welcome,
leo


Reply via email to