Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
UPDATE: After I sent off this post it occurred to me that the issues Haarg had just explained were very likely the same issues that Corion had hinted at earlier ;-)

On my Ubuntu system, it is using sprintf: $ perl -V:d_Gconvert d_Gconvert='gcvt((x),(n),(b))';

Yes - same for my Ubuntu system.
That should mean that you should also find that the script I posted in my last post outputs:
1..1 not ok 1 - they are the same # Failed test 'they are the same' # at line 40. # got: '9.2233720368547758e+18' # expected: '9223372036854775808' # Looks like you failed 1 test of 1.
The unexpected '9.2233720368547758e+18' arises because:
sv_setpvf(keysv, "%.19g", SvNV(arg)); is, in effect, converted to: sv_setpvf(keysv, "%.17g", SvNV(arg));
Can we rely on this value of $Config{d_Gconvert} to reliably indicate that such behaviour will occur ? (If so, that would be most useful.)

For my Windows 7 builds that avoid the problem, I'm finding that perl -V:d_Gconvert matches the output you're seeing on your macOS.

For sane purposes on perl's whose nvsize is double, a width of 17 decimal digits is indeed sufficient.
But when you're trying to (mis)use formatting of doubles in the way that List::Util::uniqnum() does, then you really do need a width of 19 decimal digits if ivsize is also 8.
Otherwise, for example, uniqnum(1 << 60, 2 ** 60) won't detect that the 2 values are equal.

About 6 hours ago I did submit a bug report about this to but it hasn't yet been assigned a ticket number so I currently can't provide a link.
It will be interesting to hear what p5p has to say.

The perlclib documentation explicitly says that perl functions tend not to use the standard library. While it documents how to do things "the Perl way", it doesn't say that the functions will behave identically.

I'm thinking that the perlclib docs could well make a point of stating that the functions might not behave identically - at least wrt sprintf vs sv_setpvf.


In reply to Re^2: [XS] Weird behaviour on some Linux systems by syphilis
in thread [XS] Weird behaviour on some Linux systems by syphilis

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 romping around the Monastery: (5)
    As of 2021-01-26 19:25 GMT
    Find Nodes?
      Voting Booth?