Comment on Java
Acetamide@lemmy.world 1 year ago
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.
Lmaydev@programming.dev 1 year ago
Because ints are way smaller. Over a certain value it would always fail.
larvyde@sh.itjust.works 1 year ago
Yea but at those values floating points can’t represent fractions anyway
Lmaydev@programming.dev 1 year ago
Exactly. So if cast to int you’d either get an error or 0 for everything above a certain value.