alphacyberranger to Programmer Humor@programming.devEnglish • 2 years agoJavalemmy.worldimagemessage-square93fedilinkarrow-up1585arrow-down148
arrow-up1537arrow-down1imageJavalemmy.worldalphacyberranger to Programmer Humor@programming.devEnglish • 2 years agomessage-square93fedilink
minus-square@Acetamide@lemmy.worldlinkfedilink15•2 years agoAFAIK most typed languages have this behaviour.
minus-square@Lmaydev@programming.devlinkfedilink4•2 years agoBecause ints are way smaller. Over a certain value it would always fail.
minus-squarelarvydelinkfedilink1•2 years agoYea but at those values floating points can’t represent fractions anyway
minus-square@Lmaydev@programming.devlinkfedilink1•2 years agoExactly. So if cast to int you’d either get an error or 0 for everything above a certain value.
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.