带有示例的 Scala Float toDouble() 方法
toDouble()方法用于将指定的数字转换为双精度数据类型值。
Method Definition: (Number).toDouble
Return Type: It returns the converted double datatype value.
示例 #1:
// Scala program of Float toDouble()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toDouble method
val result = (1).toDouble
// Displays output
println(result)
}
}
输出:
1.0
示例 #2:
// Scala program of Float toDouble()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toDouble method
val result = (9.5467).toDouble
// Displays output
println(result)
}
}
输出:
9.5467