Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
hitko146141dBecause max int is 2147483647, while trunc / floor / ceil of a double can have up to 308 digits.
momad28441dAlso NaN is a valid float value but can't be represented by an int. floor(NaN) == NaN
JS961799341d@momad Another valid reason, thanks!
I didn't think about a lot of cases, my bad.
@devnulli thanks, but it was. 😅
I only thought about my personal situation, not the many other cases possible.
The "return the integer part of a double" didn't make my think about the fact it doesn't mean a simple integer, because as others said here it can be much bigger.