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

Two arithmetic expressions (involving addition, multiplication, division and modulo) which should come out the same come out different in Rakudo #3636

Closed
p6rt opened this issue Jan 9, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 9, 2015

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

Searchable as RT123570$

@p6rt
Copy link
Author

p6rt commented Jan 9, 2015

From @masak

<masak> r​: say 6103515625/5; say ((((6103515625/5) * 4 + 123327057) **
2) % 6103515625); say (((1220703125 * 4 + 123327057) ** 2) %
6103515625)
<camelia> rakudo-{parrot,moar} c5dcdf​: OUTPUT«1220703125␤0␤6103515624␤»
<masak> ok -- between those three expressions, something is quite wrong.
<masak> note that the third is just the second but with the evaluated
result from the first inserted.
<masak> the second and the third should show up the same.
* masak submits rakudobug
<FROGGS_> m​: say ((((6103515625 / 5) * 4 + 123327057) ** 2) % 6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«0␤»
<FROGGS_> m​: say ((((6103515625 div 5) * 4 + 123327057) ** 2) % 6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«6103515624␤»
<masak> FROGGS_​: you're implying I'm suffering from bignum/rounding effects?
<FROGGS_> I'm implying nothing atm
< masak> anyway, FROGGS_++ for interesting data point. that goes in
the ticket, too.
<FROGGS_> m​: say ((((6103515625 / 5).Int * 4 + 123327057) ** 2) % 6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«6103515624␤»
<FROGGS_> m​: say ((((6103515625 div 5).Num * 4 + 123327057) ** 2) % 6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«0␤»
<FROGGS_> :o)

@p6rt
Copy link
Author

p6rt commented Feb 17, 2015

From @coke

On Fri Jan 09 06​:47​:29 2015, masak wrote​:

<masak> r​: say 6103515625/5; say ((((6103515625/5) * 4 + 123327057) **
2) % 6103515625); say (((1220703125 * 4 + 123327057) ** 2) %
6103515625)
<camelia> rakudo-{parrot,moar} c5dcdf​:
OUTPUT«1220703125␤0␤6103515624␤»
<masak> ok -- between those three expressions, something is quite
wrong.
<masak> note that the third is just the second but with the evaluated
result from the first inserted.
<masak> the second and the third should show up the same.
* masak submits rakudobug
<FROGGS_> m​: say ((((6103515625 / 5) * 4 + 123327057) ** 2) %
6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«0␤»
<FROGGS_> m​: say ((((6103515625 div 5) * 4 + 123327057) ** 2) %
6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«6103515624␤»
<masak> FROGGS_​: you're implying I'm suffering from bignum/rounding
effects?
<FROGGS_> I'm implying nothing atm
< masak> anyway, FROGGS_++ for interesting data point. that goes in
the ticket, too.
<FROGGS_> m​: say ((((6103515625 / 5).Int * 4 + 123327057) ** 2) %
6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«6103515624␤»
<FROGGS_> m​: say ((((6103515625 div 5).Num * 4 + 123327057) ** 2) %
6103515625)
<camelia> rakudo-moar c5dcdf​: OUTPUT«0␤»
<FROGGS_> :o)

<masak> the second and the third should show up the same.

$ ./perl6 rt123570.p6
1220703125
6103515624
6103515624

Now they do. Added test to integration/weird-errors.t, closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Feb 17, 2015

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

@p6rt p6rt closed this as completed Feb 17, 2015
@p6rt
Copy link
Author

p6rt commented Feb 17, 2015

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

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant