# [libre-riscv-dev] IEEE754 FVCT

Luke Kenneth Casson Leighton lkcl at lkcl.net
Mon Jul 8 14:46:09 BST 2019

```right, the code that was a bit of a hard-coded mess, i've extracted
most of it and made it generic, so that it can be used generally: 1 or
2 args, and 16/32/64 bit.

that now works, and i've got these working:

* add, mul and fcvt
* 16, 32 and 64 bit

on the following testing matrix:

* random range against random range
* +/- 0, +/- inf, +/- NaN permutations, all tested against all permutations
* all of those permutations (+/- 0/inf/NaN) against the following:
- nearly zero (random variations)
- minimum non-zero exponent (random variations)
- nearly infinite (random variations)
- random versions of NaN (noncanonical NaN)
- random numbers (at the full range)

where appropriate they're inverted as well (A+B and B+A)

jacob you'll be able to use this to test both the isqrt/sqrt as well
as the fpdiv.

see: ieee754/fpadd/test/test_fpadd_pipe_64.py
for an example of how to do 2-operand.  just "from operator import
truediv" just like in test_fpdiv_pipe.py

see: ieee754/fcvt/test/fcvt_data_64_16.py and
ieee754/fcvt/test/test_fcvt_pipe_64_16.py
for an example of how to do 1-operand.  for isqrt, given that there is
no such function in sfpy, it should be trivially obvious how to create
a function that computes that, and is passed in as a
higher-order-function: let's hope it's accurate enough.

the code's not set up to cope if there are no regression tests, so,
um... invent some :)

at some point, i'll add an option to increase the range (the number of
random numbers generated per test)

l.

```

More information about the libre-riscv-dev mailing list