[libre-riscv-dev] [Bug 74] preliminary exploratory software emulation of FP SQRT

bugzilla-daemon at libre-riscv.org bugzilla-daemon at libre-riscv.org
Sat Apr 27 15:04:40 BST 2019


http://bugs.libre-riscv.org/show_bug.cgi?id=74

--- Comment #7 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
hi aleksander, saw the commits 
https://git.libre-riscv.org/?p=ieee754fpu.git;a=commitdiff;h=264ec6d3b61267429026b0090047e81fe85900d5

looks great, and pretty much the exact same thing as what jacob
pointed to.  i'm curious as to why "+ bit" instead of "| bit", can
investigate that later (or if the algorithm doesn't work)

now you can use something like this, to calculate a value in
python:

>>> int(pow(7, 0.5))
2

or if you prefer,
>>> int(7 ** 0.5)
2

yes, int rounds *DOWN*.  that shouldn't be a problem initially,
although we will need to investigate what to do with the remainder
(local variable "num", in the test code that you wrote)

so, try just throwing some numbers at the sqrt function, print
them out in a loop:

for i in range(1, 20):
    print(sqrt(i))

that should do the trick.  then, modify that to include the python
version (int(pow)) as well.

you'll soon see if the function works :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-riscv-dev mailing list