alphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 1 year agoJavalemmy.worldimagemessage-square50fedilinkarrow-up1548arrow-down147
arrow-up1501arrow-down1imageJavalemmy.worldalphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 1 year agomessage-square50fedilink
minus-squarekorstmos@kbin.sociallinkfedilinkarrow-up48arrow-down1·1 year agoDoubles have a much higher max value than ints, so if the method were to convert all doubles to ints they would not work for double values above 2^31-1. (It would work, but any value over 2^31-1 passed to such a function would get clamped to 2^31-1)
minus-squareparlaptie@feddit.delinkfedilinkarrow-up5arrow-down1·1 year agoBut there’s really no point in flooring a double outside of the range where integers can be represented accurately, is there.
minus-squareaffiliate@lemmy.worldlinkfedilinkarrow-up3·1 year agoyeah that would be pretty effective. could also go to three just to be safe
Doubles have a much higher max value than ints, so if the method were to convert all doubles to ints they would not work for double values above 2^31-1.
(It would work, but any value over 2^31-1 passed to such a function would get clamped to 2^31-1)
But there’s really no point in flooring a double outside of the range where integers can be represented accurately, is there.
what about using two ints
What about two
int64_t
yeah that would be pretty effective. could also go to three just to be safe
Make it four, just to be even
A BigDecimal?