r/programming • • Aug 11 '26

Moving integer division to floating-point is trivial

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

34 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Aug 12 '26

[removed] — view removed comment

3

u/Dragdu Aug 12 '26

I didn't say can't, I said won't.

1

u/-Redstoneboi- Aug 12 '26

depends if it's inlined or not

if it's a constant and happens to get inlined, it'll probably be optimized

if it comes from user input, probably not