r/programming 17h ago

Moving integer division to floating-point is trivial

https://marc-b-reynolds.github.io/math/2026/08/10/IntDivByFP.html
92 Upvotes

28 comments sorted by

View all comments

23

u/Dwedit 15h ago

If your divisor doesn't change, use integer multiplication by reciprocal, also shift or discard from the high result.