mhhollomon / handsqrt

Emulate the algorithm to take square roots by hand

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

handsqrt

Emulate the algorithm to take square roots by hand

$>  ./sqrt.py 1000. -l 6 -x foo
Final estimate = 31.6227766
The estimate**2 = 999.99999989350756 - off by 1.0649244E-7
ratio = 1.0649244E-10 ( 106 parts per trillion )
#----------------------------
       3 1. 6 2 2 7 7 6 6
      _____
     /1000.
       9
      --
61*1 < 100
        61
       ---
626*6 < 3900
        3756
        ----
6322*2 < 14400
         12644
         -----
63242*2 < 175600
          126484
          ------
632447*7 < 4911600
           4427129
           -------
6324547*7 < 48447100
            44271829
            --------
63245546*6 < 417527100
             379473276
             ---------
632455526*6 < 3805382400
              3794733156
              ----------
                10649244

About

Emulate the algorithm to take square roots by hand

License:GNU General Public License v3.0


Languages

Language:Python 100.0%