I find it weird that it does a inner check on ' num > 99999', which pretty much only checks for 100,000. It could check for 99993, but I doubt even that check makes it much faster.
But have you checked with some other number than 30? Does it screw up the upper and lower bounds?
But have you checked with some other number than 30? Does it screw up the upper and lower bounds?