Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Negating a number

by flamey (Scribe)
on Mar 04, 2009 at 17:10 UTC ( [id://748242]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $p = 7;
    $n = -$p;        # or 0 - $p
    print $n;        # -7
    printf "%x", $n; # FFFFFFF9
    
  2. or download this
    $p = 7;
    $n = $p ^ 0xFFFF_FFFF; # im on 32-bit winxp system
    printf "%x", $n; # FFFFFFF8
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://748242]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 11:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found