Open In App

Scala Double !=(x: Float) method with example

Last Updated : 03 Sep, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In Scala, Double is a 64-bit floating point number, which is equivalent to Java’s double primitive type. The !=(x: Float) method is utilized to check whether the given Double value and float are equal to each other or not.

Method Definition – def !=(x: Float): Boolean 
Returns – Returns true if this value is not equal to x, false otherwise. 
 

Example #1:  

Scala




// Scala program to explain working
// of Double !=(x: Float) function
 
// Creating object
object GfG
{
 
    // Main method
    def main(args:Array[String])
    {
     
        // Applying !=(x: Float) function
        val result = (10.001254).toDouble.!=(10:Float)
         
        // Displays output
        println(result)
     
    }
}


Output: 

true

 

 
Example #2: 

Scala




// Scala program to explain working
// of Double !=(x: Float) function
 
// Creating object
object GfG
{
 
    // Main method
    def main(args:Array[String])
    {
     
        // Applying !=(x: Float) function
        val result = 11.86000000.toDouble.!= (1296000.5)
         
        // Displays output
        println(result)
     
    }
}


Output: 

true

 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads