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

bugzilla-daemon at libre-riscv.org bugzilla-daemon at libre-riscv.org
Mon Apr 29 07:52:00 BST 2019


--- Comment #25 from Aleksandar Kostovic <alexandar.kostovic at gmail.com> ---
>so next phase will be to use "from sfpy import Float32" and create some
>arbitrary numbers, say... oh i dunno, pick one! 753.415926535897932
>x = Float32(fred_the_number)
>xbits = x.bits
>then use the function decode_fp32(xbits) to get the s, m, e
>and from there you can throw those into the function main() and see what
>theeeeennn... you can do sq_test = x.sqrt() above... and on the answer,
>use the function decodefp32(sq_test)...
>and print those out next to the answer from using main().
>if those are even remotely close we have a winner!

Okay i understood up until the x = Float32(num) and xbits = x.bits. So i
decided to print out the values of decode_fp32 function first, to check if its
working.... aaaaand its not.

x = Float32(1234.123456789)
xbits = x.bits


which gives:
Traceback (most recent call last):
  File "/home/aleksandar/projects/ieee754fpu/src/add/fsqrt.py", line 108, in
  File "/home/aleksandar/projects/ieee754fpu/src/add/fsqrt.py", line 74, in
    return get_sign(x), get_exponent(x), get_mantissa(x)
  File "/home/aleksandar/projects/ieee754fpu/src/add/fsqrt.py", line 64, in
    return ((x & 0x80000000) >> 31)
TypeError: unsupported operand type(s) for &: 'sfpy.float.Float32' and 'int'

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

More information about the libre-riscv-dev mailing list