Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
psx:cpu:division [2012/10/23 13:07]
amidog created
psx:cpu:division [2012/10/23 13:12]
amidog
Line 2: Line 2:
  
 ====== Signed division by zero ====== ====== Signed division by zero ======
-The result of a division by zero is consistent with the result of a smiple radix-2 ("one bit at a time") implementation. That is, if the dividend is negative, the result ​is 1 (0x00000001),​ and if the dividend is positive or zero, the result ​is -1 (0xffffffff). In both cases the remainder equals the dividend.+The result of a division by zero is consistent with the result of a smiple radix-2 ("one bit at a time") implementation. That is, if the dividend is negative, the quotient ​is 1 (0x00000001),​ and if the dividend is positive or zero, the quotient ​is -1 (0xffffffff). In both cases the remainder equals the dividend.
  
 ====== Unsigned division by zero ====== ====== Unsigned division by zero ======
 +In the case of unsigned division, the dividend can't be negative and thus the quotient is always -1 (0xffffffff) and the remainder equals the dividend.
  
 ====== Signed division of most negative by minus one ====== ====== Signed division of most negative by minus one ======
- +This is actually quite interesting,​ not the result of the operation, but the fact that some CPUs (x86 for example) will trigger an arithmetic exception when dividing 0x80000000 by 0xffffffff. Thus you may be able to crash your favourite (x86) PSX emulator by a few lines of MIPS code. The result of the operation is a quotient of 0x80000000 and a remainder of 0x00000000.
Print/export