alphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 1 year agoJavalemmy.worldimagemessage-square74fedilinkarrow-up1576arrow-down147
arrow-up1529arrow-down1imageJavalemmy.worldalphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 1 year agomessage-square74fedilink
minus-squaremaniacal_gaff@lemmy.worldlinkfedilinkarrow-up32arrow-down1·1 year agoIt would be kinda dumb to force everyone to keep casting back to a double, no? If the output were positive, should it have returned an unsigned integer as well?
minus-squarelarvyde@sh.itjust.workslinkfedilinkarrow-up15·1 year agoint coerces to double automatically, without explicit casting
minus-squaresnake_baitman@lemmy.sdf.orglinkfedilinkarrow-up18·1 year agoThe CPU has to do real work to convert between float and int types. Returning an int type would just be giving the CPU extra work to do for no reason
minus-squareNotNotMike@programming.devlinkfedilinkarrow-up3·1 year agoI’m learning so much from this thread and I don’t even use Java
It would be kinda dumb to force everyone to keep casting back to a double, no? If the output were positive, should it have returned an unsigned integer as well?
int
coerces todouble
automatically, without explicit castingThe CPU has to do real work to convert between float and int types. Returning an int type would just be giving the CPU extra work to do for no reason
I’m learning so much from this thread and I don’t even use Java