Scala Double +(x: Float) 方法与示例
+(x: Float)方法用于查找参数中指定的 double 和给定的“x”类型的浮点数之和。
Syntax: def +(x: Float): Double
Returns: It return the sum of the specified double and the given float type ’x’.
示例 1:
// Scala program of +(x: Float)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Float) method
val result = 2.39432456.+(4.940213)
// Displays output
println(result)
}
}
输出:
7.334537559999999
示例 2:
// Scala program of +(x: Float)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Float) method
val result = 5.39432456.+(32.940213)
// Displays output
println(result)
}
}
输出:
38.33453756