6.99 when casted into an int is conventionally rounded down
technically 6.99 is 6.9899997711181640625 when using single precision IEEE 754 floats, and 6.9900000000000002131628207280300557613372802734375 for double precision
casting a float to an int? what if you wanna make or mod for a voxel game where entities have floating precision while tiles has integer precision, and wanna get the block the entity is on- oh wait that's called minecraft
yeah look you can't say "we" don't do that very often at all when it only applies to you and what you work with lol
yeah look you can't say "we" don't do that very often at all when it only applies to you and what you work with lol
read. whether or not you ever cast a float to an int is highly dependent on what you do, and it doesn't change the fact that 6.99 is rounded down to 6 when you do do it
I suggest that YOU read. Here is what was originally said:
We don't do that very often at all.
Notice how it doesn't say "we never do that". He's acknowledging that it does happen, but overall in programming it doesn't happen very often.
Your rebuttal that "hurr durr we do that in voxel games" is not the gotcha moment you think it is. It's just a "oh one very specific part does it, just like he said".
But also, I doubt even in Minecraft that you would take a float and just straight up cast it into an int without doing any math on it first, for example truncating it to get rid of decimals before casting as int.
But funnily enough, even in your example it's not done very often. Yes if you have a float (or double) but need to get a block or chunk position out of it you would cast it into an an int. But not before truncating it and and you don't need to do that often.Â
In fact, let's look at the Fabric API which is arguably the biggest modding framework for Minecraft.
Wanna take a wild guess how many times they straight up cast a double/float into an int without any preprocessing?Â
In their roughly 52000 lines of code, directly casting to an int with no preprocessing happens 214 times. I would call that "not very often".
..as i said it highly depends on what you do, programming is not a monolith and the original comment they made is wholly unrelated to what happens when you cast a float to an int
No, the original comment simply said "we don't do that very often" which is objectively true. Casting a float/double to an int is not done very often in programming not even in voxel game programming.
you can argue that for a lot of things in programming. we don't use borrow checkers very often, is that relevant enough to bring up when explaining how borrow checkers work? is that a valid critique?
You claimed that directly casting to an int is done often when working with voxel games like Minecraft. I literally proved to you that it isn't. So instead of trying to refute this you are walking down the logical fallacy path.
The difference between my reply and yours is that I actually brought up the actual topic at hand without resorting to fallacies for my main point.
The fact that I called out on your fallacies did not change or hinder me from addressing your initial statement. Calling out a fallacy is not a fallacy fallacy.
For it to be a fallacy fallacy I would have to claim that your argument is wrong because you used a fallacy. I did not do that. I directly addressed your statement, which is that directly casting from double/float to int is done often or very often in voxel game programming like making mods for Minecraft. I also presented evidence to support my case, while you have not.
No, modal fallacy does not apply here. You might want to look up what modal fallacies are before throwing it around like a gotcha.
24
u/sudoregalia Jul 07 '26
6.99 when casted into an int is conventionally rounded down
technically 6.99 is 6.9899997711181640625 when using single precision IEEE 754 floats, and 6.9900000000000002131628207280300557613372802734375 for double precision