Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Does int128() and uint128() croak for "0400000000000000000000000000000000000000"?

It should now ;-)

Does $x + undef and the like warn?


(Note that «undef + $x» cannot warn without making «my $x; $x += int128(...)» warn.)
Operations with undefs always generate warnings. Emulating the Perl behavior for built-ins up to this level is not one of my targets.
Does signed to unsigned promotion occur when required? (e.g. when adding two a large number overflows.)

Does unsigned to signed promotion occur when required? (e.g. when subtraction overflows to something negative.)

No, automatic promotions would just complicate the semantics of the module too much. Currently, the module provides modulo 2**128 signed and unsigned arithmetic and the semantics are pretty simple:

Are the string buffers always suitably aligned for a int128_t? (You use memcpy in some spots, but casts in others.)

Internally 128bit values are stored on the stack or on the PV slot of an SV allocated with newSV(16). As GCC seems to use 64bit instructions to load 128 bits integers from memory, alignment should be right.

In reply to Re^7: Module for 128-bit integer math? by salva
in thread Module for 128-bit integer math? by BrowserUk

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (4)
    As of 2020-10-30 13:15 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (279 votes). Check out past polls.