fma:Exception "Underflow" not set

赵爱南 zhaoainan163@163.com
Fri Mar 28 02:31:41 GMT 2025


> Hello:
> I'm nanzhu and a glibc developer, now I have a error in glibc2.34,below:
> FAIL:math/test-float-fma
> original exit status 1
> testing float (without inline functions)
> Failuer: fma (-0x8p-152, 0x8.8p-4, -0x3.fffff8p-128): Exception "Underflow" not set
> ...............................
>
>
> I think this result should not overflow. The calculation process is as follows:
>
>
> -0x8p-152  * 0x8.8p-4  - 0x3.fffff8p-128 
>
> =-2^(-126)* 2^(-23) *(1+2^(-4))* 2^(-1)- 2^(-126)*(1-2^(-23))
> --2^(-126)*( 2^(-24) *(1+2^(-4))+ 1-2^(-23))
> =-2^(-126)*( 2^(-24) +2^(-28)+ 1-2^(-23))
> =-2^(-126)*( 1-2^(-24)+ 2^(-28))
> The result is rounded to the nearest nearest value and equals:-2^(-126)= 0xb810000000000000,No overflow occurred.

This calculation is for double, right?  The testing happens for float
according to your initial message.

Thanks,
Florian
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
--------------------------------------------------------------------------------------




No,our calculation is for float。


Only round once during floating-point multiplication and addition calculations.So in our calculation process, we did fusion instead of adding -0x3.fffff8p-128 based on the result of -0x8p-152 * 0x8.8p-4


Because in the  IEEE Std 754™-2019 :

"The operation fusedMultiplyAdd(x, y, z) computes (x×y)+z as if with unbounded range and

precision, rounding only once to the destination format."



thanks.






-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 151728 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-help/attachments/20250328/99697438/attachment-0001.png>


More information about the Libc-help mailing list