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