New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.pick on large ranges returns binary-sparse result #5734
Comments
From @ajsFrom IRC: [15:12] <harmil_wk> m: say ((2**80) ..^ (2**81)).pick.base(2) The middle part is always a large number of zeros, but it's my -- |
From @pmichaudOn Fri, Oct 07, 2016 at 12:18:43PM -0700, Aaron Sherman wrote:
Awesome catch! The current implementation of Range.pick() is based on I'm guessing nqp::rand_I() is returning a 32-bit number, and so Range.pick/ Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @lizmat
$ 6 'use nqp; say "$_: {nqp::rand_I(2**$_,Int).base(2)}" for 58 .. 65' $ 6 'use nqp; say "$_: {nqp::rand_I(2**$_,Int).base(2)}" for 120 .. 130' Feels slightly more complicated than that. But there’s definitely some 32bitness involved. Liz |
From @lizmat
Actually, this appears to be a MoarVM specific issue: $ ./perl6 -e 'use nqp; say "$_: {nqp::rand_I(2**$_,Int).base(2)}" for 58 .. 65' $ ./perl6 -e 'use nqp; say "$_: {nqp::rand_I(2**$_,Int).base(2)}" for 120 .. 130' |
From @lizmat
Digging deeper into the rabbit hole, I wind up at: MVM_bigint_rand in src/math/bigintops.c: and there the mp_rand and mp_mod calls feel suspect to me. But then I’m out of my league, so I hope that someone else will be able to pick up from here. Liz |
From @timoApparently libtommath is known to leave some bits 0 when specific not sure why it's been quiet since april. |
From @zoffixznetLooks like libtommath has now been fixed: libtom/libtommath#57 On Sat Oct 08 14:47:40 2016, timo wrote:
|
From @lizmat
Great! But what is the policy on 3rdparty module updates? Do we wait for the next libtommath release now? Or do we patch it in the MoarVM repo now? |
From @skidsOn Mon, 10 Oct 2016 04:29:33 -0700, elizabeth wrote:
MoarVM commit 6d5ea042fda removed the original workaround from PR#357 |
@skids - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#129829 (status was 'resolved')
Searchable as RT129829$
The text was updated successfully, but these errors were encountered: