Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Negating a number

by Illuminatus (Curate)
on Mar 04, 2009 at 17:24 UTC ( #748246=note: print w/replies, xml ) Need Help??

in reply to Negating a number

What is right, indeed... Depends on what you are trying to do. Please read 2's compleent. If you are doing ordinary arithmetic, then what you are doing is probably what you want. If you are doing something like calculating a TCP checksum, then the other method is closer to (but not exactly) what you want.

Replies are listed 'Best First'.
Re^2: Negating a number
by ramrod (Curate) on Mar 04, 2009 at 17:33 UTC
    Illuminatus is going the right direction.
    Your first example yields the binary of negative seven.
    The second example is the negation of the bits of a hex seven.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://748246]
[erix]: (but then there's always a next (im)possible goal)
Corion avoids running by starting on time
[choroba]: my phone showed me 1 hour 10 km which was my goal, it changed a bit after uploading to the website
[erix]: choroba I believe you ;)
[1nickt]: Corion I assume you are talking about Retry? Attempt doesn;t offer callbacks and has a much simpler interface. (Also written by someone I trust...)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2017-05-24 12:56 GMT
Find Nodes?
    Voting Booth?