nifty to Programmer Humor@programming.dev • 4 months agoStop using floatslemmy.worldimagemessage-square79fedilinkarrow-up1769
arrow-up1769imageStop using floatslemmy.worldnifty to Programmer Humor@programming.dev • 4 months agomessage-square79fedilink
minus-square@Psythik@lemmy.worldlinkfedilink14•4 months agoWhile we’re at it, what the hell is -0 and how does it differ from 0?
minus-square@computerscientistI@lemm.eelinkfedilink2•4 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?
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.