How to convert a float to a double in Kotlin

1 Answer

0 votes
fun main() {
    val f: Float = 12.34f
    val d: Double = f.toDouble()

    println("Float value: $f")
    println("Double value: $d")
}


/*
run:

Float value: 12.34
Double value: 12.34000015258789

*/

 



answered Apr 12 by avibootz
...