Calculated values can experience a number overflow and return 0, in the event the first part of the calculation is multiplication which pushes the 64-bit integer (Long) negative.
println(Long.MAX_VALUE * 6L / 8L)
// 0
println((Long.MAX_VALUE.toDouble() * 6.0 / 8.0).toLong())
// 6917529027641081856
Note that with 32-bit integer (Int), the calculation succeeds if converted to 64-bit integer b/c Int.MAX_VALUE * 6 is less than Long.MAX_VALUE, so will fit.
A failure example is Base64.Default.config.encodeOutSize(Long.MAX_VALUE returning 0 currently. Base32 is also affected.
Calculated values can experience a number overflow and return 0, in the event the first part of the calculation is multiplication which pushes the 64-bit integer (Long) negative.
Note that with 32-bit integer (Int), the calculation succeeds if converted to 64-bit integer b/c
Int.MAX_VALUE * 6is less thanLong.MAX_VALUE, so will fit.A failure example is
Base64.Default.config.encodeOutSize(Long.MAX_VALUEreturning 0 currently.Base32is also affected.