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

Unsigned int in highest bit length, stays negative #3740

Open
p6rt opened this issue Mar 16, 2015 · 5 comments
Open

Unsigned int in highest bit length, stays negative #3740

p6rt opened this issue Mar 16, 2015 · 5 comments
Labels
JVM Related to Rakudo-JVM

Comments

@p6rt
Copy link

p6rt commented Mar 16, 2015

Migrated from rt.perl.org#124088 (status was 'open')

Searchable as RT124088$

@p6rt
Copy link
Author

p6rt commented Mar 16, 2015

From @lizmat

[16​:41​:26] <lizmat> m​: my uint64 @​a = -1; say @​a.perl # same for uint
[16​:41​:27] <+camelia> rakudo-moar 21f01b​: OUTPUT«array[uint64].new(-1)␤»
[16​:41​:57] <lizmat> I guess this would be the same for uint32 on 32bit machines
[16​:42​:11] lizmat rakudobugs

@p6rt
Copy link
Author

p6rt commented Jan 28, 2016

From @zoffixznet

Seem you can also just decrement the uints past their boundaries too​:
$ perl6 -e 'my uint64 $a = 1; --$a for ^10; say $a'
-9

@p6rt
Copy link
Author

p6rt commented Jan 28, 2016

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

@p6rt p6rt added the severe A problem that is encountered frequently, or a problem that needs attention for other reasons label Jan 5, 2020
@usev6
Copy link

usev6 commented Jan 22, 2022

As a status update: The first evaluation works as expected now. (@niner reworked support for uint -- see MoarVM/MoarVM#1647, Raku/nqp#757 and rakudo/rakudo#4706):

$ ./rakudo-m -e 'my uint64 @a = -1; say @a.perl'
array[uint64].new(18446744073709551615)
$ ./rakudo-m --version
Welcome to Rakudo™ v2021.12-141-g3823f88ce.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2021.12-80-gb585b5e32.

The corresponding test in S09-typed-arrays/native-int.t has been unfudged with Raku/roast@774722cfe8.

The second example still has problems, but as far as I understand chances are much better now to fix this as well:

$ ./rakudo-m -e 'my uint64 $a = 1; --$a for ^10; say $a'
-9

@usev6
Copy link

usev6 commented Mar 20, 2022

And indeed, the problem has been fixed for MoarVM by now:

$ ./rakudo-m -e 'my uint64 $a = 1; --$a for ^10; say $a'
18446744073709551607
$ ./rakudo-m --version
Welcome to Rakudo™ v2022.02-115-g6e383c204.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.02-38-g588e00d60.

There were similar tests in S02-types/int-uint.t that have been unfudged with Raku/roast@774722cfe8.

Since the problem is still present on the JVM backend, I'm changing the tags:

  • "severe"
  • "jvm"

@usev6 usev6 added JVM Related to Rakudo-JVM and removed severe A problem that is encountered frequently, or a problem that needs attention for other reasons labels Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JVM Related to Rakudo-JVM
Projects
None yet
Development

No branches or pull requests

2 participants