Closed Bug 1869396 Opened 1 year ago Closed 1 year ago

BigInt.toString() truncates value with power-of-two radices

Categories

(DevTools :: Console, defect)

Firefox 120
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: bugzilla, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0

Steps to reproduce:

const i = 0x6aaf20fed58ba5e6db692909e78e5c5c6525e28d1cfa8bd22dc216729b4841b3;
const big = BigInt(i);

console.log('0x' + big.toString(16))

Actual results:

Trailing digits are replaced with zeros:

"0x6aaf20fed58ba400000000000000000000000000000000000000000000000000"

Expected results:

The result should be the same as the initial value (i):

"0x6aaf20fed58ba5e6db692909e78e5c5c6525e28d1cfa8bd22dc216729b4841b3"

The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Console
Product: Firefox → DevTools
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.