79665336

Date: 2025-06-13 20:16:51
Score: 0.5
Natty:
Report link
BigInt(0xffffffff) << BigInt(32)

will return the proper 18446744069414584320n

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Left_shift#description

For BigInts, there's no truncation. Conceptually, understand positive BigInts as having an infinite number of leading 0 bits, and negative BigInts having an infinite number of leading 1 bits.

Current definition of << operator for BigInt: https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-numeric-types-bigint-leftShift

Diff between BigInt and number: https://tc39.es/proposal-bigint/#sec-bitwise-shift-operators

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: n0099