Thank you, Stéphane
So a workaround is:
b =uint64(2)^61+1
bb2=uint64(bin2dec(strsplit(strrev(bitstring(b))))');
bb1=bitget(b,1:64);
bb2(1)-bb1(1)
ans = 1
A bit of a waste to use uint64 to store single bits, but that is what
bitget does:
--> typeof(bb1)
ans = "uint64"
Jan
On 2020-02-27 16:55 PM, Stéphane Mottelet wrote:
But the problem with bitget remains. The new bitstring is ok:
--> bitstring(a)
ans =
"0010000000000000000000000000000000000000000000000000000000000000"
--> bitstring(a+1)
ans =
"0010000000000000000000000000000000000000000000000000000000000001"
S.
Le 27/02/2020 à 16:37, Stéphane Mottelet a écrit :
You should generate big ints like this:
a=uint64(2)^61
S.
Le 27/02/2020 à 16:17, JLan a écrit :
I wonder if i have misunderstood the documentation for bitget, or if
this is
a bug? It seems to me that numbers > 2^53 are still not handled
correctly.
--> a=uint64(2^61)
a = 2305843009213693952
--> b=uint64(2^61)+1
b = 2305843009213693953
--> bitget(a,1:64)
ans =
column 1 to 32
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0
column 33 to 64
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 1 0 0
--> bitget(b,1:64)
ans =
column 1 to 32
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0
column 33 to 64
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 1 0 0
--
Sent from:
https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[email protected]
https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users