SHARE
TWEET

Square rooter

ranisalt Sep 27th, 2013 40,771 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def squirtle(n):
  2.         i = 1
  3.         while i * i < n:
  4.                 i += 1
  5.                
  6.         a, b = float(i), float(n) / i
  7.         for i in xrange(0, 2**7):
  8.                 a, b = (a + b) / 2, float(n) / a
  9.                
  10.         return b
  11.        
  12. print "%.16f" % (squirtle(2), )
RAW Paste Data
Pastebin PRO Autumn Special!
Get 40% OFF on Pastebin PRO accounts!
Top