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

uint32 behaving like int64 #3779

Closed
p6rt opened this issue Apr 13, 2015 · 5 comments
Closed

uint32 behaving like int64 #3779

p6rt opened this issue Apr 13, 2015 · 5 comments
Labels
Bug severe A problem that is encountered frequently, or a problem that needs attention for other reasons

Comments

@p6rt
Copy link

p6rt commented Apr 13, 2015

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

Searchable as RT124294$

@p6rt
Copy link
Author

p6rt commented Apr 13, 2015

From @grondilu

Hello

$ perl6 -e 'say my uint32 $ = 2**32;'
4294967296
$ perl6 -e 'say my uint32 $ = 2**64;'
0
$ perl6 -e 'say my uint32 $ = 2**63;'
-9223372036854775808
$ perl6 -e 'say my uint32 $ = 2**62;'
4611686018427387904

$ perl6 --version
This is perl6 version 2015.03-245-g0b1e4f1 built on MoarVM version
2015.03-102-g3f29518

My machine is a i686 (32bits) running GNU/Debian Sid.

@p6rt
Copy link
Author

p6rt commented Sep 24, 2015

From helmut.wollmersdorfer@fixpunkt.de

[BUG]

[13​:02] <wollmers> m​: my uint64 $z = 0 +| (1 +< 62);say sprintf("%064b",$z);
[13​:02] <+camelia> rakudo-moar f89dc2​: OUTPUT«0100000000000000000000000000000000000000000000000000000000000000␤»

[13​:04] <wollmers> m​: my uint64 $z = 0 +| (1 +< 63);say sprintf("%064b",$z);say $z;
[13​:04] <+camelia> rakudo-moar f89dc2​: OUTPUT«-1000000000000000000000000000000000000000000000000000000000000000␤-9223372036854775808␤»
[13​:05] <wollmers> m​: my uint64 $z = 0 +| (1 +< 62);say sprintf("%064b",$z);say $z;
[13​:05] <+camelia> rakudo-moar f89dc2​: OUTPUT«0100000000000000000000000000000000000000000000000000000000000000␤4611686018427387904␤»
[13​:05] <wollmers> m​: my uint64 $z = 0 +| (1 +< 62);say sprintf("%064b",$z);say $z;say ($z > 0);
[13​:05] <+camelia> rakudo-moar f89dc2​: OUTPUT«0100000000000000000000000000000000000000000000000000000000000000␤4611686018427387904␤True␤»
[13​:06] <wollmers> m​: my uint64 $z = 0 +| (1 +< 63);say sprintf("%064b",$z);say $z;say ($z > 0);
[13​:06] <+camelia> rakudo-moar f89dc2​: OUTPUT«-1000000000000000000000000000000000000000000000000000000000000000␤-9223372036854775808␤False␤»
[13​:07] <wollmers> m​: my uint64 $z = 0 +| (1 +< 63);say sprintf("%064b",$z);say $z;say ($z > 0);say $z.lsb,' ',$z.msb;
[13​:07] <+camelia> rakudo-moar f89dc2​: OUTPUT«-1000000000000000000000000000000000000000000000000000000000000000␤-9223372036854775808␤False␤63 63␤»

[13​:10] <wollmers> m​: my uint64 $z = +^0;say sprintf("%064b",$z);say $z;say ($z > 0);say $z.lsb,' ',$z.msb;
[13​:10] <+camelia> rakudo-moar f89dc2​: OUTPUT«00000000000000000000000000000000000000000000000000000000000000-1␤-1␤False␤0 0␤»

@p6rt
Copy link
Author

p6rt commented Dec 18, 2015

From @jnthn

On Mon Apr 13 16​:42​:11 2015, grondilu@​yahoo.fr wrote​:

Hello

$ perl6 -e 'say my uint32 $ = 2**32;'
4294967296
$ perl6 -e 'say my uint32 $ = 2**64;'
0
$ perl6 -e 'say my uint32 $ = 2**63;'
-9223372036854775808
$ perl6 -e 'say my uint32 $ = 2**62;'
4611686018427387904

$ perl6 --version
This is perl6 version 2015.03-245-g0b1e4f1 built on MoarVM version
2015.03-102-g3f29518

My machine is a i686 (32bits) running GNU/Debian Sid.

We didn't really implement unsigned/sized types for lexicals properly until recently. I've now fleshed out that support a good bit, and uint8, uint16, and uint32 are in much better shape. I've added tests in S02-types/native.t. I'd like to do more exhaustive tests, as well as sort out various issues around uint64, but have used all the time I'm likely to get on this topic ahead of the xmas release. So, we'll settle for the improvements so far, knock this off the xmas list, but leave it open for later review.

@p6rt
Copy link
Author

p6rt commented Dec 18, 2015

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

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

usev6 commented Mar 21, 2022

I assume these things are better now. @niner did some major rework for uint recently and the tests for this ticket (which were added to S02-types/native.t with Raku/roast@08952f65f9) are passing now on MoarVM.

I'm closing this ticket now. (If there are remaining problems with uint64, we should open a new ticket over at https://github.com/rakudo/rakudo/issues.)

@usev6 usev6 closed this as completed Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug severe A problem that is encountered frequently, or a problem that needs attention for other reasons
Projects
None yet
Development

No branches or pull requests

2 participants