alphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 1 year agoJavalemmy.worldimagemessage-square77fedilinkarrow-up1585arrow-down148
arrow-up1537arrow-down1imageJavalemmy.worldalphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 1 year agomessage-square77fedilink
minus-squareAcetamide@lemmy.worldlinkfedilinkarrow-up15·1 year agoAFAIK most typed languages have this behaviour.
minus-squareLmaydev@programming.devlinkfedilinkarrow-up4·1 year agoBecause ints are way smaller. Over a certain value it would always fail.
minus-squarelarvyde@sh.itjust.workslinkfedilinkarrow-up1·1 year agoYea but at those values floating points can’t represent fractions anyway
minus-squareLmaydev@programming.devlinkfedilinkarrow-up1·1 year 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.