Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualParadigm Shifter

Posted 22 August 2013 - 03:49 PM

Fixed point maths. Pick a power of 2 to represent the number 1, e.g. 216 = 65536.

 

Every time you multiply two fixed point numbers you need to divide by the number representing 1 (so 65536 in this example), which is just a shift (>>16 in this case). Every time you divide two fixed point numbers you multiply (shift up) instead of divide. Watch out for overflows!

 

So 0.5 * 0.5 would be (32768 * 32768) >> 16 = 16384 which represents 1/4

 

PS1 used 4096 to represent 1 which didn't overflow as much. You can use 256 instead but lose fractional bits then.

 

You have to generate sin, cos, etc. tables for the fixed point system as well.


#2Paradigm Shifter

Posted 22 August 2013 - 03:47 PM

Fixed point maths. Pick a power of 2 to represent the number 1, e.g. 216 = 65536.

 

Every time you multiply two fixed point numbers you need to divide by the number representing 1 (so 65536 in this example), which is just a shift (>>16 in this case). Every time you divide two fixed point numbers you multiply (shift up) instead of divide. Watch out for overflows!

 

So 0.5 * 0.5 would be (32768 * 32768) >> 16 = 16384 which represents 1/4

 

PS1 used 4096 to represent 1 which didn't overflow as much.


#1Paradigm Shifter

Posted 22 August 2013 - 03:46 PM

Fixed point maths. Pick a power of 2 to represent the number 1, e.g. 216 = 65536.

 

Every time you multiply two fixed point numbers you need to divide by the number representing 1 so 65536 in this example), which is just a shift (>>16 in this case). Every time you divide two fixed point numbers you multiply (shift up) instead of divide. Watch out for overflows!

 

So 0.5 * 0.5 would be (32768 * 32768) >> 16 = 16384 which represents 1/4

 

PS1 used 4096 to represent 1 which didn't overflow as much.


PARTNERS