Skip Menu |
Report information
Id: 124294
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: grondilu [at] yahoo.fr
helmut.wollmersdorfer [at] fixpunkt.de
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Subject: [BUG] uint32 behaving like int64
From: Lucien Grondin <grondilu [...] yahoo.fr>
Date: Tue, 14 Apr 2015 01:41:51 +0200
Download (untitled) / with headers
text/plain 375b
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.
To: rakudobug [...] perl.org
From: Helmut Wollmersdorfer <helmut.wollmersdorfer [...] fixpunkt.de>
Date: Thu, 24 Sep 2015 13:22:41 +0200
Subject: [BUG] uint64 does not behave unsigned
Download (untitled) / with headers
text/plain 1.6k
[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␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 976b
On Mon Apr 13 16:42:11 2015, grondilu@yahoo.fr wrote: Show quoted text
> 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.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org