<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Samuel</p>
<p>My suggestion for a workaround (looks like my first reply
disappeared):</p>
<p>b =uint64(2)<sup class="moz-txt-sup"><span
style="display:inline-block;width:0;height:0;overflow:hidden">^</span>61</sup>+1
<br>
<br>
bb2=uint64(bin2dec(strsplit(strrev(bitstring(b))))');
<br>
<br>
bb1=bitget(b,1:64);
<br>
<br>
bb2(1)-bb1(1)
<br>
<br>
ans = 1
<br>
<br>
A bit of a waste to use uint64 to store single bits, but that is
what bitget does:
<br>
<br>
--> typeof(bb1)
<br>
ans = "uint64" <br>
</p>
<p>Jan<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 2020-02-27 17:51 PM, Samuel Gougeon
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:9e59d89d-ab76-579f-7ec8-f0dda77ad2b0@free.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">As suspected, the bug originates from
the * operator, that is still not reliable between uint64 or
int64:</div>
<div class="moz-cite-prefix"><tt>--> b</tt><tt><br>
</tt><tt> b = </tt><tt><br>
</tt><tt> 230584300921369395</tt><b><tt><font color="#ff0000">5</font></tt></b><tt><br>
</tt><tt><br>
</tt><tt>--> b * uint64(1)</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> 230584300921369395</tt><b><tt><font color="#ff0000">2</font></tt></b><br>
<br>
This was reported in 2018 @ <a class="moz-txt-link-freetext"
href="http://bugzilla.scilab.org/15836" moz-do-not-send="true">http://bugzilla.scilab.org/15836</a>
and is still unfixed.<br>
<br>
For bitget, i will see how to do, if there is a workaround. If
not, at least warn users in the help page.<br>
</div>
<div class="moz-cite-prefix"><br>
Samuel</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Le 27/02/2020 à 16:58, Samuel Gougeon
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:4295c7fd-c9a4-b584-285d-7192b249d76c@free.fr">Le
27/02/2020 à 16:17, JLan a écrit : <br>
<blockquote type="cite">I wonder if i have misunderstood the
documentation for bitget, or if this is <br>
a bug? It seems to me that numbers > 2^53 are still not
handled correctly. <br>
--> a=uint64(2^61) <br>
a = 2305843009213693952 <br>
--> b=uint64(2^61)+1 <br>
b = 2305843009213693953 <br>
</blockquote>
<br>
bitget(b,1) <br>
<br>
--> bitget(b,1) <br>
ans = <br>
0 <br>
<br>
is a bug. <br>
bitget.tst tests int64 and uint64 cases with other inttypes: <br>
--> edit
SCI\modules\elementary_functions\tests\unit_tests\bitget.tst <br>
<br>
When bitget() has been extended to 64 bits integers ~3 years
ago, several bugs have appeared about the processing of these
integers by other Scilab functions, noticeably some functions
involved in the bitget implementation. <br>
Not all are fixed (actually, only few of them are fixed). <br>
But maybe it's another issue here. I could have a look, about
this specific case. <br>
<br>
If you can do other tests and get issues, please report all of
them on bugzilla. <br>
Thanks <br>
<br>
_______________________________________________ <br>
users mailing list <br>
<a class="moz-txt-link-abbreviated"
href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<br>
<a class="moz-txt-link-freetext"
href="http://lists.scilab.org/mailman/listinfo/users"
moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>
<br>
</blockquote>
<p><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
</body>
</html>