Sam Stone
06/23/2022, 3:53 AMclosest(1.03)=1.05
, closest(1.02)=1.00
, closest(1.05)=1.05
altavir
06/23/2022, 6:16 AMaltavir
06/23/2022, 6:17 AMround(d*20.0)/20.0
Gleb Minaev
06/23/2022, 12:50 PMa
multiple of b
):
2. a - a.IEEErem(b)
(IEEErem
is from kotlin.math
and iss available only for K/JVM and K/Native)
3. (a + b/2).let { it - it.mod(b) }
In both cases we just subtract remainder of division of a
by b
to get product of the division's quotient and the divisor b
.Sam Stone
06/24/2022, 1:44 AM