develooper Front page | perl.perl6.internals | Postings from February 2006

integer divide overflow

Thread Next
From:
Leopold Toetsch
Date:
February 9, 2006 16:18
Subject:
integer divide overflow
Message ID:
c97ed3c377ad3853e2c285397540bcf9@toetsch.at
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


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About