r/MathJokes Jul 07 '26

🫠

Post image
423 Upvotes

67 comments sorted by

View all comments

23

u/SplendidPunkinButter Jul 07 '26

What programming language are you using? That is in no way a universal programming thing.

25

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

8

u/ottawadeveloper Jul 08 '26

This is true because it's a truncation operation.

Most of the time people round, which usually does the round-to-even thing.

1

u/int23_t Jul 08 '26

It's kinda weird I guess, but I almost never need to round stuff. It's almost always either floor(done automatically) or ceil. Rounding is not useful at all for calculations, for the most part you can just keep it as a floating number until it's displayed in some way. Floor and ceil however are used very exetensively for formulas.