[Scilab-users] Bitget for int64/uint64
Samuel Gougeon
sgougeon at free.fr
Fri Feb 28 16:25:26 CET 2020
Hello Jan,
You will find => there
<https://codereview.scilab.org/cat/21421%2C2%2Cscilab/modules/elementary_functions/macros/bitget.sci>
a fixed version of bitget() for big u-int64 integers.
You can patch your Scilab 6.1.0 installation in the following way:
* download and unzip the file. rename it bitget.sci
* put bitget.sci in the SCI/elementary_functions/macros directory
* Run the following Scilab code in the console:
cd SCI/elementary_functions/macros
predef clear
genlib elementary_functionslib
clear bitget
And then test and use bitget in the current session and all forthcoming
ones.
Regards
Samuel
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200228/3577ec4f/attachment.htm>
More information about the users
mailing list