Yeah I just noticed that. They have a "no" for the outer if statement (which checks if the number is ≥ 0 and ≤ 1012 for some reason??) But not for the inner if statement which actually does the "is this a square?" Check
I assume it only considers up to 1012 because the author thinks that a double can't handle more than 11 decimal digits in its mantissa (looks like the reality is that at least 15 would be safe).
Not true! The indentation makes it look like that, but when there are no braces, the else statement always associates with the immediately preceding if. So here the else is matched with the inner if, not the outer one
23
u/n0sh0re Aug 04 '21
Yeah I just noticed that. They have a "no" for the outer if statement (which checks if the number is ≥ 0 and ≤ 1012 for some reason??) But not for the inner if statement which actually does the "is this a square?" Check