[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 11:25:42 BST 2019
http://bugs.libre-riscv.org/show_bug.cgi?id=74
--- Comment #28 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Aleksandar Kostovic from comment #27)
> >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().
>
> Okay so i am confused by the thing i should do but tried to understand, so
> added:
>
> + sq_test = x.sqrt()
> + e, m = decode_fp32(sq_test)
> + print(main(e, m))
>
> and get an error:
> File "/home/aleksandar/projects/ieee754fpu/src/add/fsqrt.py", line 64, in
> get_sign
> return ((x & 0x80000000) >> 31)
> TypeError: unsupported operand type(s) for &: 'sfpy.float.Float32' and 'int'
you did exactly the same thing, doh! you passed in sq_test (an object)
*NOT* the bits *OF* the object, which are an integer.
- sq_test = x.sqrt()
+ sq_test = x.sqrt.bits
also, decode_fp32 returns a tuple of 3 items: sign, exponent, mantissa.
you can't assign a tuple of length 3 to a tuple of length 2 (e, m)
- e, m = decode_fp32(sq_test.bits)
+ s, e, m = decode_fp32(sq_test.bits)
try git pull.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-riscv-dev
mailing list