Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://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 w.pl 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 perlbug@perl.org 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.

Cheers,
Rob

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

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 avoiding work at the Monastery: (5)
As of 2024-03-28 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found