531
Java
(lemmy.world)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
I'm going to guess here (cause I feel this community is for learning)....
Integers have exactness. Doubles have range.
So if
MAX_INT + 1
is possible, then~(MAX_INT + 1)
is probably preferable to an overflow or silentMIN_INT
.But
Math.ceil
probably expects a float, because it is dealing with decimals (or similar). If it was an int, rounding wouldn't be required.So if
Math.ceil
returned and integer, then it could parse a float larger than INT_MAX, which would overflow an int (so error, or overflow). Or just return a float