Thank you Samuel

For some reason I get an error message :

--> genlib elementary_functionslib
genlib: Cannot open file ''C:\Program Files\scilab-6.1.0\modules\elementary_functions\macros\lib''.
 ans  =  F

Although scinotes("lib") opens the file, so it is there.

Anyway, this works fine:

--> exec bitget.sci;
Warning : redefining function: bitget                  . Use funcprot(0) to avoid this message

Regards

Jan


On 2020-02-28 16:25 PM, Samuel Gougeon wrote:
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


_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to