长时间无符号的位移位操作-一次关闭

问题描述

我在c#中有一个简单的移位操作,正在移植到JS。您可以在这里看到它:https://dotnetfiddle.net/Au62NB

//C# code
ulong v = 2630423132685782527;
UInt32 v1 = (UInt32)(v >> 32);
UInt32 v0 = (UInt32)((v << 32) >> 32);
Console.WriteLine("v1:v0 " + v1 +" : " + v0); //v1:v0 612443111 : 280284671

在NodeJS(280284672)中,值v0始终为1。我已经尝试过在google,BigInt,npm的big-integer库等所有可以找到的东西。有人有想法吗?

let v = BigInt('2630423132685782527');

let v1 = v >> BigInt(32)
let v0 = (v << BigInt(32)) >> BigInt(32);
v0 = Number(v0) >>> 0; //not even sure why I have to do this,something with converting signed/unsigned.

console.log("v1:v0",Number(v1),Number(v0)); //"v1:v0",612443111,280284672

解决方法

JavaScript的import pytest import openpyxl class test_Read_From_Excel: workbook_object = openpyxl.load_workbook("/Users/kartik.tumu/Desktop/Testing Screen Shots/CBS/Selenium/Test Data.xlsx") print(workbook_object.sheetnames) #object of sheet "sh" sh = workbook_object["TestData"] #object of cell "c1" username c1 = sh.cell(6,4) #object of cell "p1" password p1 = sh.cell(6,5) print(p1.value) print(c1.value) print('\n Testcase Passed','green') print("==================================================") 对于大于2 53 -1(又称{Number,也就是2 ** 53 - 1 = 9007199254740991)的数字没有概念。
要使用任意较大的值表示带符号整数,请使用BigInt (在Safari和IE和10.4之前的Node中不可用)

也值得一读:BigInt/asUintN

BigInt.asUintN 静态方法用于将BigInt值包装为介于0和2 width -1之间的无符号整数。

Number.MAX_SAFE_INTEGER

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...