I want to convert an integer to number with specific base. In this case it's 36.
So as documentation states I do myNumber.toString(36)
.
Here are the results:
console.log((12345678901234566).toString(36));
console.log((12345678901234567).toString(36));
console.log((12345678901234568).toString(36));
console.log((12345678901234569).toString(36));
console.log((12345678901234570).toString(36));
console.log((12345678901234571).toString(36));
as you can see there's something off because the output is not unique.
From what I've found Number.MAX_SAFE_INTEGER = 9007199254740991
and my numbers exceed that value so I believe that's why it's treated differently
It's a shame that it's not stated anywhere in the documentation that there are some boundaries. Maybe it's common knowledge, I don't know.
Any ideas how to approach this issue for bigger numbers?
I can see that here it's implemented wrongly (as in my example) and here correctly but I don't know the logic behind it.