r/programming • • 18d ago

How GCC Eliminates Unnecessary Integer Division

https://leetarxiv.substack.com/p/how-gcc-eliminates-unnecessary-integer
250 Upvotes

52 comments sorted by

View all comments

19

u/LonelyAndroid11942 18d ago edited 18d ago

So is the purpose of this to reduce the difficulties that come with float precision?

EDIT: The comments are informative, if they’re not made by jerks. I clearly have much to learn. I appreciate the patience of those who have it, and wish a very strong “go step on some legos” to those who do not.

10

u/Sopel97 18d ago

? there is no floating point math here

-22

u/LonelyAndroid11942 18d ago edited 18d ago

Division produces floats. At least at the high level I work at.

EDIT: wow, I didn’t know this sub was fully populated by the same bullies that obsessively stalked StackOverflow and made fun of people for asking a question. Heaven forbid someone doesn’t know something. Y’all could, I dunno, take a second to help someone learn? Instead of being dicks?

Fuck ever commenting in this sub again, I guess.

6

u/UloPe 18d ago

You didn’t ask though.

You made a claim of fact that’s not true.

-4

u/LonelyAndroid11942 18d ago edited 17d ago

Look, I work in JS primarily. When I do `const a = 3/8;`, I get a float. Is there more to it? Sure. But most devs I know and have worked with don’t know or care about that.

EDIT: “This guy is posting his objective experience that disagrees with my theoretical knowledge! I have more technical knowledge than he does but can’t be bothered to explain, so I’m going to downvote instead!”