const balance = 9007199254740991n; // Number.MAX_SAFE_INTEGER as BigInt
const fee = 1n;
const multiplier = 2n;
const total = (balance + fee) * multiplier;
const asNumber = Number(total);
const isSafe = Number.isSafeInteger(asNumber);
const isExact = BigInt(asNumber) === total;
console.log(`${total}n | safe: ${isSafe} | exact: ${isExact}`);
Post #3311
2.33K
CHALLENGE
- ❤ 3
- 👍 2
- 🔥 1