#Make sure that cython extension is installed
#> pip install --user cython
# The source code of the add16u_08V extension needs to be downloaded first
> curl -s "https://ehw.fit.vutbr.cz/evoapproxlib/v1.2022?folder=adders/16_unsigned/pareto_pwr_wce&file=add16u_08V.c&pyx=bash" | bash
#Finally, the extension can be used in a Python script as follows
> python
import pyximport; pyximport.install()
import add16u_08V
wce = e = 0
for i in range(0,2**16):
for j in range(0,2**16):
diff = abs(add16u_08V.add(i,j) - (i+j))
if diff > wce: wce = diff
e += diff
print('average error magnitude (mae)',e/(2.0**(17)))
print('worst-case error magnitude (wce)',wce)