nifty@lemmy.world to Programmer Humor@programming.dev · 1 年前Stop using floatslemmy.worldimagemessage-square79fedilinkarrow-up1774
arrow-up1774imageStop using floatslemmy.worldnifty@lemmy.world to Programmer Humor@programming.dev · 1 年前message-square79fedilink
minus-squarePsythik@lemmy.worldlinkfedilinkarrow-up14·1 年前While we’re at it, what the hell is -0 and how does it differ from 0?
minus-squarecomputerscientistI@lemm.eelinkfedilinkarrow-up2·1 年前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.
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.