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
method rand (Range) ignores $!excludes-max flag #5620
Comments
From @titsukiSee the following result $ perl6 -e '(1..^(1+10e-15)).rand.say' $ perl6 -e 'say 1.00000000000001 - (1+10e-15)' $ perl6 -e '(1..^(1+10e-15)).excludes-max.say' I think that the 1st example it shouldn't return 1+10e-15, since Range.excludes-max is True. My Perl 6 version is |
From @titsuki*1st example shouldn't On 2016-8月-26 金 22:31:11, cookbook_000@yahoo.co.jp wrote:
|
From @lizmatWelcome to the world of floating point accuracy. This little program typically ends within 100 iterations for me: $ 6 'my int $a = 0; $a++ while (1..^(1+10e-15)).rand < 1+10e-15; say $a’ Either we dismiss this bug as being caused by lack of floating point accuracy, or we build in something special in .rand for Num Ranges that will make sure that the returned value actually is less then upper range as indicated by “<“. I would mark this RT as a @LARRY case.
|
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznetOn Fri, 26 Aug 2016 22:31:11 -0700, cookbook_000@yahoo.co.jp wrote:
Thank you for the report. This is now fixed (to clarify, what's fixed is the Fix rakudo/rakudo@334d134 I'm also reproducing the fix commit message since it answers some of the Fix Range.rand generating value equal to excluded endpoints Fixes RT#129104: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129104 The discussion in the ticket speculates this only affects Num ranges, The problem is due to us checking generated value against zero and I measured performance impact of this on 100,000 iterations and found |
@zoffixznet - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#129104 (status was 'resolved')
Searchable as RT129104$
The text was updated successfully, but these errors were encountered: