Addition Anomaly - Memory Issue?

Viewed 26

I've been writing a function that adds to integers in such a way that the result of the exponential multiplication is the one decimal greater than the second integer, e.g. 2*10**1 + 2 = 22, 2*10**2 = 222 ... now I've run into the following anomaly:

console.log((4 * 10**16) + 5390195186705543)
//logs: 45390195186705544

For some reason, it changes the first decimal to 4. Does it have anything to do with memory allocation?

0 Answers
Related