小编x70*_*66c的帖子

为什么 2 ** (1 << 31) == 0?

在节点 REPL 中运行它,给我:

> 2 ** (1 << 31)
0

Run Code Online (Sandbox Code Playgroud)

我还为此编写了一个小算法,它给了我 1。

> 2 ** (1 << 31)
0

Run Code Online (Sandbox Code Playgroud)

问题:

  1. 为什么 REPL 0 中的实际答案是?
  2. 我上面的算法有什么问题吗?

javascript algorithm bit-manipulation

0
推荐指数
1
解决办法
82
查看次数

标签 统计

algorithm ×1

bit-manipulation ×1

javascript ×1