Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Sorry, I'm afraid I don't follow... but since you mention the high bit, note how in two's complement, the high bit is basically the sign bit. And the other nice thing is that the binary math still works well:

  • -8+1 is 1000+0001, which =1001, which is -7
  • -2-2 is 1110+1110, which =11100, drop the overflow and 1100 is -4
  • -2+5 is 1110+0101, which =10011, drop the overflow and 0011 is 3

Of course, there are still overflow issues, e.g. 7+1 turns out as -8, but those will always happen with any fixed number of bits. Of course, the advantage of Perl's scalars here is that they will upgrade themselves automatically! (At the risk of losing some precision)


In reply to Re^7: Can I access and use UV types from perl? by haukex
in thread Can I access and use UV types from perl? by Don Coyote

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2024-04-24 14:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found