Open In App

Scala Float toDouble() method with example

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


Last Updated : 29 Oct, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads