diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index 58441ecab..dc7c4828c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -83,12 +83,10 @@ object NumberUtil { */ fun Double.roundTo(precision: Int): Double { val scale = 10.0.pow(precision) - return kotlin.math.round(scale) / scale + return kotlin.math.round(this * scale) / scale } - fun Float.roundTo(precision: Int): Float { - return toDouble().roundTo(precision).toFloat() - } + fun Float.roundTo(precision: Int): Float = toDouble().roundTo(precision).toFloat() @Deprecated("Use roundTo instead", ReplaceWith("this.roundTo(precision)")) fun Double.roundToPrecision(precision: Int) = this.roundTo(precision) |