Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by Haarg (Curate)
on Oct 14, 2019 at 11:50 UTC ( #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 (Bishop) 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
Node Status?
node history
Node Type: note [id://11107410]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2020-10-30 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (278 votes). Check out past polls.

    Notices?