Decimal input: 76561198291043943
Hex output: 110000113b74660
Hex expected output: 110000113b74667
For some reason, when I use the following snippet and execute it, the expected result does not occur, but when I use https://www.binaryhexconverter.com/decimal-to-hex-converter to convert a decimal number to a hex string, I get the expected output.
console.log(Number(76561198291043943).toString(16))
76561198291043943
is greater than Number.MAX_SAFE_INTEGER
.
Use BigInt
instead:
console.log(BigInt("76561198291043943").toString(16))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.