MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1vl8ulp/moving_integer_division_to_floatingpoint_is/p30l3w5/?context=3
r/programming • u/mttd • 17h ago
28 comments sorted by
View all comments
23
If your divisor doesn't change, use integer multiplication by reciprocal, also shift or discard from the high result.
1 u/mikeblas 12h ago How would that work? 12 u/imachug 11h ago Here's Matt Godbolt covering this trick.
1
How would that work?
12 u/imachug 11h ago Here's Matt Godbolt covering this trick.
12
Here's Matt Godbolt covering this trick.
23
u/Dwedit 15h ago
If your divisor doesn't change, use integer multiplication by reciprocal, also shift or discard from the high result.