Just in case anyone mistakes that for a good way to calculate the nearest integer to the square root of an integer that takes about five times longer than...
int Sqrt(int x){ return(sqrt(x)+0.5);}
|
It also doesn't always round correctly. Strangely it is only wrong at 20 out of the first million integers. [/source]
Edited by - LilBudyWizer on March 8, 2001 3:12:22 AM