Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If they're expressed in two's complement, this works for negative numbers as well.


Duh, of course that's how multiplication works. If one operand is negative, so will be the sign bit of the result. If both are negative, then the result should be and does come out positive, as the sign bit XORs to 0 and so do all adjacent bits that are 1 in both operands.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: