Skip to content
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

Rat literal fails for moderately large numerator #4551

Closed
p6rt opened this issue Sep 18, 2015 · 8 comments
Closed

Rat literal fails for moderately large numerator #4551

p6rt opened this issue Sep 18, 2015 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Sep 18, 2015

Migrated from rt.perl.org#126103 (status was 'resolved')

Searchable as RT126103$

@p6rt
Copy link
Author

p6rt commented Sep 18, 2015

From zefram@fysh.org

$ ./perl6 -e 'my $a = <2147483647/1>; say 1'
1
$ ./perl6 -e 'my $a = <2147483648/1>; say 1'
===SORRY!===
Cannot find method 'compile_time_value'

This happens with any numerator >= 2**31. Denominators that big aren't
a problem. .perl uses this literal format in its output, so this problem
on input prevents .perl.EVAL round-tripping some Rats.

-zefram

@p6rt
Copy link
Author

p6rt commented Sep 23, 2015

From @carbin

carlin m​: <1176079147668/815>
camelia rakudo-moar f2488e​: OUTPUT«===SORRY!===␤Cannot find method 'compile_time_value'␤»

That format is the result returned by Instant.perl​:

carlin m​: my $x = now; say $x.perl
camelia rakudo-moar f2488e​: OUTPUT«Instant.new(<1176079147668/815>)␤»

Therefore, EVAL(now.perl) doesn't work​:

carlin m​: my $x = now; EVAL($x.perl)
camelia rakudo-moar f2488e​: OUTPUT«===SORRY!===␤Cannot find method 'compile_time_value'␤»

psch++ had this insight​:

psch m​: <2147483647/8>
camelia rakudo-moar f2488e​: ( no output )
psch m​: <2147483648/8>
camelia rakudo-moar f2488e​: OUTPUT«===SORRY!===␤Cannot find method 'compile_time_value'␤»

psch carlin​: i suspect 2**31 - 1 working and 2**31 not is a hint :)

--
Carlin

@p6rt
Copy link
Author

p6rt commented Sep 23, 2015

From zefram@fysh.org

This is a duplicate of [perl #​126103].

-zefram

@p6rt
Copy link
Author

p6rt commented Sep 23, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 3, 2017

From @AlexDaniel

This was fixed in (2016-02-07) rakudo/rakudo@2775261

my $a = <2147483648/1>; say $a # OUTPUT​: «2147483648␤»

So it works now, as well as anything bigger​:

my $a = <99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999/1>; say $a # OUTPUT​: «99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999␤»

my $a = <99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999/2>; say $a # OUTPUT​: «49999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.5␤»

「testneeded」

On 2015-09-18 13​:31​:54, zefram@​fysh.org wrote​:

$ ./perl6 -e 'my $a = <2147483647/1>; say 1'
1
$ ./perl6 -e 'my $a = <2147483648/1>; say 1'
===SORRY!===
Cannot find method 'compile_time_value'

This happens with any numerator >= 2**31. Denominators that big aren't
a problem. .perl uses this literal format in its output, so this problem
on input prevents .perl.EVAL round-tripping some Rats.

-zefram

@p6rt
Copy link
Author

p6rt commented Dec 3, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 11, 2017

From @zoffixznet

Tests​: Raku/roast@b610337bd5

@p6rt
Copy link
Author

p6rt commented Dec 11, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant