Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: [XS] Weird behaviour on some Linux systems

by Haarg (Priest)
on Oct 14, 2019 at 11:50 UTC ( [id://11107410]=note: print w/replies, xml ) Need Help??


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

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.

I certainly sympathize. I've been trying to solve the same problem in List::Util::PP, and so far have settled on using roughly pack('FJ', $_, $_). There are still some issues around the unsigned int upper boundary though.

It should be possible to avoid the special case to use Gconvert by tweaking the format you use. I can get the full width output on my Ubuntu system by using '%0.19g':

$ perl -e'printf "%.19g\n", 2 ** 57'
1.4411518807585587e+17
$ perl -e'printf "%0.19g\n", 2 ** 57'
144115188075855872

Replies are listed 'Best First'.
Re^4: [XS] Weird behaviour on some Linux systems
by syphilis (Archbishop) on Oct 14, 2019 at 13:11 UTC
    I can get the full width output on my Ubuntu system by using '%0.19g'

    Good catch. That works with sv_setpvf() in XS, too.
    I'll incorporate it into https://github.com/Dual-Life/Scalar-List-Utils/pull/80 tomorrow.
    AFAIK that pull request does the job fine - but this observation of yours should enable me to reduce a bit of clutter in Makefile.PL and ListUtil.xs.

    Thanks !!

    Cheers,
    Rob

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-19 06:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found