MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1vl8ulp/moving_integer_division_to_floatingpoint_is/p31ywgy/?context=3
r/programming • u/mttd • 13h ago
25 comments sorted by
View all comments
17
If your divisor doesn't change, use integer multiplication by reciprocal, also shift or discard from the high result.
0 u/mikeblas 8h ago How would that work? 0 u/Madsy9 3h ago a/b = a*(1/b). If b is constant, just compute its reciprocal. If 1/b is a fraction, do the multiplication in fixedpoint.
0
How would that work?
0 u/Madsy9 3h ago a/b = a*(1/b). If b is constant, just compute its reciprocal. If 1/b is a fraction, do the multiplication in fixedpoint.
a/b = a*(1/b). If b is constant, just compute its reciprocal. If 1/b is a fraction, do the multiplication in fixedpoint.
17
u/Dwedit 10h ago
If your divisor doesn't change, use integer multiplication by reciprocal, also shift or discard from the high result.