这个 JAVA朗,数学。楼层() 返回小于或等于参数且等于最接近的数学整数的双精度值。 注:
null
- 如果论点是正确的 整数 ,然后 后果 是 整数 .
- 如果论点是正确的 楠 或者 无穷 或 正零 或 负零 ,然后 结果 是吗 相同的 作为论据。
公共静态双层(双a) a: 要确定其下限值的参数 返回: 此方法返回小于或等于的双精度值 等于最接近的数学整数。
例子: 表示工作 JAVA朗,数学。楼层() 方法
// Java program to demonstrate working // of java.lang.Math.floor() method import java.lang.Math; class Gfg { // driver code public static void main(String args[]) { double a = 4.3 ; double b = 1.0 / 0 ; double c = 0.0 ; double d = - 0.0 ; double e = - 2.3 ; System.out.println(Math.floor(a)); // Input Infinity, Output Infinity System.out.println(Math.floor(b)); // Input Positive Zero, Output Positive Zero System.out.println(Math.floor(c)); // Input Negative Zero, Output Negative Zero System.out.println(Math.floor(d)); // Input -2.3, Output -3.0 // Nearest Integer(-3.0) < less than (-2.3) System.out.println(Math.floor(e)); } } |
输出:
4.0 Infinity 0.0 -0.0 -3.0
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END