Scala Double /(x: Double) method
In Scala, Double is a 64-bit floating point number, which is equivalent to Java’s double primitive type. The /(x: Double) method is utilized to return the quotient of this value and given value x.
Method Definition – def /(x: Double): Double
Returns – Returns the quotient of this value and x.
Example #1:
// Scala program to explain the working // of Double /(x: Double) method // Creating object object GfG { // Main method def main(args : Array[String]) { // Applying /(x: Double) function val result = ( 12.251100 .toDouble)./( 3 : Double) // Displays output println(result) } } |
Output:
4.083699999999999
Example #2:
// Scala program to explain the working // of Double /(x: Double) method // Creating object object GfG { // Main method def main(args : Array[String]) { // Applying /(x: Double) function val result = ( 16.02505 .toDouble)./( 5 : Double) // Displays output println(result) } } |
Output:
3.20501
Contact Us