doubles can hold numbers way larger than even 64-bit ints
Comment on Java
disencentivized@programming.dev 1 year agoWhy not just return a long?
Beanie@programming.dev 1 year ago
thegamer@burggit.moe 1 year ago
A double could also be NaN and any operations with NaN should return NaN afaik
RoyaltyInTraining@lemmy.world 1 year ago
A double can represent numbers up to ± 1.79769313486231570x10^308, or roughly 18 with 307 zeroes behind it. You can’t fit that into a long, or even 128 bits. Even though rounding huge doubles is pointless, since only the first dozen digits or so are saved, using any kind of Integer would lead to inconsistencies, and thus potentially bugs.