How to use the model from Python
> curl -s "https://ehw.fit.vutbr.cz/evoapproxlib/v1.2022?folder=multiplers/16x16_signed/pareto_pwr_mse&file=mul16s_HG4.c&pyx=bash" | bash
> python
import pyximport; pyximport.install()
import mul16s_HG4
def u2s(v):
if v & 2147483648:
return v - 4294967296
return v
wce = e = 0
for i in range(-2**15,2**15):
for j in range(-2**15,2**15):
diff = abs(u2s(mul16s_HG4.mul(i,j)) - (i*j))
if diff > wce: wce = diff
e += diff
print('average error magnitude (mae)',e/(2.0**(32)))
print('worst-case error magnitude (wce)',wce)