I'm trying to find the largest number by finding the point at which the JavaScript number line wraps around. E.g., if it could only hold numbers 0, 1, 127
then I'd find 127
by using the fact that "127 + 1 = 0
". So I made a function
function getLargestNumber ( )
{
var somethingBig = 12939123, last = (somethingBig - 1);
while ( ++somethingBig > ++last );
return last;
}
but that's causing an infinite loop (or crashing the browser for some other reason).
Is there anything wrong with the logic of my function?