Why is this an issue?
them to a variable.
What is the potential impact?
When you are saving a number that is too big or contains a fraction that is not expressible in the 64-bit floating-point format, it gets rounded
which will lead to unexpected behaviours when it will be used.
How to fix it
When you need to store a large number, use
BigInt(). Pay attention that operations between
types raise an error, so you will have to adapt your code accordingly.
For numbers with digits after the decimal, it is recommended to use a library to ensure that calculation errors are not introduced by rounding.
Noncompliant code example
const foo = 2312123211345545367
const bar = 0.123456789123456789
const foo = BigInt(2312123211345545367)
// use a library like decimal.js for storing numbers containing decimal digits
How does this work?
huge numbers as in numbers with decimal digits. When attempting to store a number that can not be represented in this format into a variable, the
number gets rounded before storage.