Re: integer divide overflow

2006-02-10 Thread Nicholas Clark
On Fri, Feb 10, 2006 at 10:52:42AM +0100, Leopold Toetsch wrote: > > On Feb 10, 2006, at 3:15, Joshua Isom wrote: > > [ quoting rearranged - please don't toppost ] > > >On Feb 9, 2006, at 6:20 PM, Leopold Toetsch wrote: > > >>$ cat div.pasm > >>set I0, 0x8000 > >>div I1, I0, -1 > >>print I1

Re: integer divide overflow

2006-02-10 Thread Jonathan Worthington
"Leopold Toetsch" <[EMAIL PROTECTED]> wrote: Strange, but it exists for just on case (well not strange, there are just more negative numbers ...): $ cat div.pasm set I0, 0x8000 Which is the largest negative number we can represent in 32 bit integers (-2147483648). div I1, I0, -1 print I

Re: integer divide overflow

2006-02-10 Thread Leopold Toetsch
On Feb 10, 2006, at 3:15, Joshua Isom wrote: [ quoting rearranged - please don't toppost ] On Feb 9, 2006, at 6:20 PM, Leopold Toetsch wrote: $ cat div.pasm set I0, 0x8000 div I1, I0, -1 print I1 print "\n" end Why not case it to switch it to 0x7fff? In any case, if the code's a

Re: integer divide overflow

2006-02-09 Thread Joshua Isom
Why not case it to switch it to 0x7fff? 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 floatin