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
[fxp] Fix special cases in Fixed::checked_add_generic.
This fixes two classes of bugs in fixed-point addition.
First, in the existing special case for handling addition of fixed-points
with different scales where shifting the addend with the smaller scale
left yielded a value that did not fit in i128, the special case was wrong
when the result's scale differed from that of the added with the larger
scale. This fixes the problem and adds a test.
Second, the code did not handle the special case where the sum of the
addends does not fit in i128 in the larger of the scales of the addends
but it would fit with the scale of the result. This also fixes that bug
and adds a test.
Signed-off-by: Ben Pfaff <blp@feldera.com>
0 commit comments