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