[libre-riscv-dev] [Bug 74] preliminary exploratory software emulation of FP SQRT
    bugzilla-daemon at libre-riscv.org 
    bugzilla-daemon at libre-riscv.org
       
    Sun Apr 28 11:23:20 BST 2019
    
    
  
http://bugs.libre-riscv.org/show_bug.cgi?id=74
--- Comment #12 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
this is how you do decrementing ranges in python:
-    for i in range(15):
-        i -= 1
+    r = 0 # remainder
+    for i in range(15, -1, -1): # negative ranges are weird...
from the c code:
    //initialize all the variables.
    a = num;
    q = 0;
    i = 0;
    left = 0;   //input to adder/sub
    right = 0;  //input to adder/sub
    r = 0;  //remainder
.... ---> python ....
-    r = None
-    D = None
+    D = num # D is input (from num)
+    r = 0 # remainder
i also restored the "simple" version, so that it can be used as
a comparative visual test against the new one.
now if you do "assert sqrt(Q) == int(Q**0.5)" in that loop, and make
the loop say... run to 65536, you'll get a good idea of whether it's
going to work.
-- 
You are receiving this mail because:
You are on the CC list for the bug.
    
    
More information about the libre-riscv-dev
mailing list