Skip to content

Improvement of accuracy of function BASOP_Util_Add_Mant32Exp() in lib_com/basop_util.c

The function BASOP_Util_Add_Mant32Exp() does not norm the input values before comparing exponents. By the obligatory right-shift by 1, mantissas with big headroom loose one bit and cause considerable errors.

In some of the 62 testcases, this function is called with the following values (input values to add, a + b) that cause great relative errors ('rel'):

  • rel= 0.111, a = 0x40000000/1, b = 0xFFFE0009/14
  • rel= 0.291, a = 0x00000003/24, b = 0x575E2000/-4
  • rel=10.259, a = 0xFFFFFFFF/34, b = 0x001A50CC/13 ...

By norming the input values (mantissa, exponent), bit-loss is limited to maximum 2 LSB.

Edited by JÜRGEN Gerstacker