尝试对两个大数进行异或,结果不正确。
例子:
> 7894237947293^4353453453
105105424
例如,在 python 上,它得到正确答案:
>>> 7894237947293^4353453453
7898549962768
如何在 node.js 上进行异或运算?
最佳答案
使用 bignum 库 https://github.com/justmoon/node-bignum
var bignum = require('bignum');
var b = bignum('7894237947293').xor('4353453453');
关于javascript - node.js 中具有大数字的按位运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23915045/