quoted: 2nd line is jt1's line quoted by giblit, ironically...
giblit (3377)
ironically, division operators are listed under Multiplicative
giblit:
4 / 2 is the same as 4 * 0.5
Same reason why + and - are under additive.
1 - 2 is the same as 1 + (-2)
another giblit quote:
giblit (3377)
I was talking about in math not the difference between int's and floating point numbers. Yes, I know that int's floor. Anyways, if I ever have to divide by 2 and I am using an integer I will simply shift it right 1 bit.
By the way jt1 I never said that 4 * 0.5 is division. I simply stated 4 * 0.5 is the same as 4 / 2 (as in end result).
jt1 response:
|
if you never said that 4 * 0.5 is division, why did you say "4 / 2 is the same as 4 * 0.5".
|
that's saying division is same as multiplying. divisions can have the same result as multipliers.
certainly not the same.
bit shift could be used to get a divisor or multiplier result.
00000010 = 2 from this
00000100 = 4 to this
a bitshift from bit 2 to bit 3 can give the result of 4 as if 2 * 2 = 4 was done
could be useful or the other direction to be like a division was done.
00000100 = 4 from this
00000001 = 1 to this
as if 4 / 4 was done equaling 1. same result