nifty@lemmy.world to Programmer Humor@programming.dev · 7 months agoStop using floatslemmy.worldimagemessage-square55fedilinkarrow-up1642arrow-down133
arrow-up1609arrow-down1imageStop using floatslemmy.worldnifty@lemmy.world to Programmer Humor@programming.dev · 7 months agomessage-square55fedilink
minus-squarePsythik@lemmy.worldlinkfedilinkarrow-up12·7 months agoWhile we’re at it, what the hell is -0 and how does it differ from 0?
minus-squarecomputerscientistI@lemm.eelinkfedilinkarrow-up2·7 months agoFor integers it really doesn’t exist. An algorithm for multiplying an integer with -1 is: Invert all bits and add 1 to the right-most bit. You can do that for 0 of course, it won’t hurt.
While we’re at it, what the hell is -0 and how does it differ from 0?
It’s the negative version
For integers it really doesn’t exist. An algorithm for multiplying an integer with -1 is: Invert all bits and add 1 to the right-most bit. You can do that for 0 of course, it won’t hurt.