Open In App

Scala Float toDouble() method with example

Last Updated : 29 Oct, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The toDouble() method is utilized to convert the specified number into double datatype value.

Method Definition: (Number).toDouble

Return Type: It returns the converted double datatype value.

Example #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)
      
    }


Output:

1.0

Example #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)
      
    }


Output:

9.5467


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads