Java

alphacyberranger@lemmy.world to Programmer Humor@programming.dev – 530 points –
77

You are viewing a single comment

AFAIK most typed languages have this behaviour.

Because ints are way smaller. Over a certain value it would always fail.

Yea but at those values floating points can't represent fractions anyway

Exactly. So if cast to int you'd either get an error or 0 for everything above a certain value.