Advertisement

Finding a square root

Started by March 07, 2001 08:25 PM
9 comments, last by YPhysicist 23 years, 11 months ago
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
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement