https://kotlinlang.org logo
#getting-started
Title
# getting-started
a

Alexander Maryanovsky

04/14/2022, 12:43 PM
Is there anything in Kotlin that would help with formatting a number with a given amount of significant digits (not decimal places)?
e

ephemient

04/14/2022, 1:03 PM
if you're on JVM, just use Java formatting. if you're not on JVM, https://youtrack.jetbrains.com/issue/KT-21644
a

Alexander Maryanovsky

04/14/2022, 6:21 PM
Java formatting is not too useful for this. The Java way is jumping through some hoops with BigDecimal, which is pretty inefficient.
2 Views