You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Found that exp2f_rcp has a precision-handling issue when dealing with 0xfe value #2408
Another question I have is, why do we directly return 1 when biased_exp == 0? What is the reason behind this? I would really appreciate it if you could help answer this question.
Hi @Monekyzoon. I think v2.9 has the expected behavior. That's because in function float_to_e8m0 we return 0xFE when input is inf, so it makes more sense to just return 0 rather than 2^-127 since 0xFE doesn't really represent 2^127 but instead infinity here.
As for your second question, when biased_exp is 0, since we only keep the exponential part when encoding it to e8m0, we can't restore the mantissa part, and the original float scale factor could be anything between 0 to 2^-127 (these won't be rounded up to exp=0x1), which means the reciprocal could be very large or even inf when the scale factor is really small. I think returning 1 is a reasonable choice here.
I can ask the numeric team if you still have questions about why we decided to compute this way. Thanks!
Activity
Monekyzoon commentedon Nov 21, 2025
(1) When the TE version is v2.0, if the value of biased_exp is 0xFE, the return value is 2^-127.
(2) When the TE version is v2.9, if the value of biased_exp is 0xFE, the return value is 0.
Which of these two TE versions is the expected behavior?
Monekyzoon commentedon Nov 21, 2025
Another question I have is, why do we directly return 1 when biased_exp == 0? What is the reason behind this? I would really appreciate it if you could help answer this question.
Monekyzoon commentedon Nov 21, 2025
@timmoon10 @ptrendx can you have a look?thanks
kainzhong commentedon Jan 13, 2026
Hi @Monekyzoon. I think v2.9 has the expected behavior. That's because in function
float_to_e8m0we return 0xFE when input is inf, so it makes more sense to just return 0 rather than 2^-127 since 0xFE doesn't really represent 2^127 but instead infinity here.As for your second question, when
biased_expis 0, since we only keep the exponential part when encoding it to e8m0, we can't restore the mantissa part, and the original float scale factor could be anything between 0 to 2^-127 (these won't be rounded up to exp=0x1), which means the reciprocal could be very large or even inf when the scale factor is really small. I think returning 1 is a reasonable choice here.I can ask the numeric team if you still have questions about why we decided to compute this way. Thanks!