java math 类_Java Math类静态双层(double d)示例
java math 类
数学班静态双层(双D) (Math Class static double floor(double d))
This method is available in java.lang package.
此方法在java.lang包中可用。
In this method if the value of the given positive argument after decimal point is 0 or greater than 0 so in that case it returns the same number before decimal point else if the value of the given negative argument after decimal point is greater than 0 so it returns (the same number +1) before decimal point.
在此方法中,如果给定的正参数的小数点后的值是0或大于0,那么在这种情况下,它在小数点前返回相同的数字,否则,如果给定的负参数的值后小数点后大于0,则它在小数点前返回(相同的数字+1)。
This is a static method so this method is accessible with the class name too.
这是一个静态方法,因此也可以使用类名访问此方法。
The return type of this method is double that means it returns the greatest floating-point value of the given argument and the argument value may be less than or equal to the given argument.
此方法的返回类型为double,这意味着它将返回给定参数的最大浮点值,并且参数值可能小于或等于给定参数。
In this method, we pass only one parameter as an argument in the method of Math class.
在此方法中,我们仅将一个参数作为参数传递给Math类的方法。
This method does not throw any exception.
此方法不会引发任何异常。
Syntax:
句法:
public static double floor(double d){
}
Parameter(s):
参数:
double d – A double value whose greatest floating-poin value to be found.
double d-一个双精度值,其最大浮点值将被找到。
Note:
注意:
If we pass "NaN", it returns "NaN".
如果我们传递“ NaN”,则返回“ NaN”。
If we pass a positive infinity, it returns the same i.e. a positive infinity.
如果我们传递一个正无穷大,它将返回相同的值,即一个正无穷大。
If we pass a negative infinity, it returns the same i.e. a negative infinity.
如果我们传递一个负无穷大,它将返回相同的值,即一个负无穷大。
If we pass 0 (-0 or 0), it returns the same.
如果我们传递0(-0或0),则返回相同值。
Return value:
返回值:
The return type of this method is double, it returns the greatest floating-point value of the given value.
此方法的返回类型为double ,它返回给定值的最大浮点值。
Java程序演示floor(double d)方法的示例 (Java program to demonstrate example of floor(double d) method)
// Java program to demonstrate the example of floor(double d)
// method of Math Class
public class FloorMethod {public static void main(String[] args) {// Here we are declaring few variables
double d1 = 7.0 / 0.0;
double d2 = -7.0 / 0.0;
double d3 = 0.0;
double d4 = -0.0;
double d5 = -123.1;
double d6 = 123.456;
// Display previous value of d1,d2,d3,d4,d5 and d6
System.out.println(" Before implementing floor() so the value of d1 is :" + d1);
System.out.println(" Before implementing floor() so the value of d2 is :" + d2);
System.out.println(" Before implementing floor() so the value of d3 is :" + d3);
System.out.println(" Before implementing floor() so the value of d4 is :" + d4);
System.out.println(" Before implementing floor() so the value of d4 is :" + d5);
System.out.println(" Before implementing floor() so the value of d4 is :" + d6);
// Here , we will get (Infinity) because we are passing parameter
// whose value is (infinity)
System.out.println("After implementing floor() so the value of d1 is :" + Math.floor(d1));
// Here , we will get (-Infinity) because we are passing parameter
// whose value is (-infinity)
System.out.println("After implementing floor() so the value of d2 is :" + Math.floor(d2));
// Here , we will get (0.0) because we are passing parameter
// whose value is (0.0)
System.out.println("After implementing floor() so the value of d3 is :" + Math.floor(d3));
// Here , we will get (-0.0) because we are passing parameter
// whose value is (-0.0)
System.out.println("After implementing floor() so the value of d4 is :" + Math.floor(d4));
// Here , we will get (-124.0) because we are passing parameter
// whose value is (-123.1)
System.out.println("After implementing floor() so the value of d5 is :" + Math.floor(d5));
// Here , we will get (123.0) because we are passing parameter
// whose value is (123.456)
System.out.println("After implementing floor() so the value of d6 is :" + Math.floor(d6));
}
}
Output
输出量
E:\Programs>javac FloorMethod.java
E:\Programs>java FloorMethod
Before implementing floor() so the value of d1 is :Infinity
Before implementing floor() so the value of d2 is :-Infinity
Before implementing floor() so the value of d3 is :0.0
Before implementing floor() so the value of d4 is :-0.0
Before implementing floor() so the value of d4 is :-123.1
Before implementing floor() so the value of d4 is :123.456
After implementing floor() so the value of d1 is :Infinity
After implementing floor() so the value of d2 is :-Infinity
After implementing floor() so the value of d3 is :0.0
After implementing floor() so the value of d4 is :-0.0
After implementing floor() so the value of d5 is :-124.0
After implementing floor() so the value of d6 is :123.0
翻译自: https://www.includehelp.com/java/math-class-static-double-floor-double-d-with-example.aspx
java math 类
java math 类_Java Math类静态双层(double d)示例相关推荐
- java math 类_Java Math类静态长轮(double d)示例
java math 类 数学课静态长回合(双D) (Math Class static long round(double d) ) This method is available in java. ...
- java使用数学公式_java Math类数学公式运算
java Math类数学公式运算.Math类 java提供了基本的+,-,*,/算数运算符,同时也提供了更复杂的运算符,比如三角函数,对数元,指数运算 Math是一个工具类.它的构造器被定义为priv ...
- java常用class类_java常用类
java常用类 内部类 1.成员内部类:在一个类的内部定义一个完整的类 例如:外部类public class Body{ 内部类class Header{ } } 内部类可以直接访问外部类的私有成员, ...
- java 大数类_Java大数类介绍
java能处理大数的类有两个高精度大整数BigInteger和高精度浮点数BigDecimal,这两个类位于java.math包内,要使用它们必须在类前面引用该包:import java.math.B ...
- java 比较器类_java常用类——比较器
Comparable和Comparator接口都是为了对类进行比较,众所周知,诸如Integer,double等基本数据类型,java可以对他们进行比较,而对于类的比较,需要人工定义比较用到的字段比较 ...
- java file 工具_JAVA文件类工具
FileUtil package cn.jiangzeyin.util.file; import org.springframework.util.Assert; import java.io.*; ...
- java math.sin()_Java Math sin() 使用方法及示例
Java Math sin() 使用方法及示例 Java Math sin()返回指定角度的三角正弦值. sin()方法的语法为: Math.sin(double angle) sin()参数angl ...
- java scanner 回车_Java Scanner类用法及nextLine()产生的换行符问题实例分析
本文实例讲述了Java Scanner类用法及nextLine()产生的换行符问题.分享给大家供大家参考,具体如下: 分析理解:Scanner sc = new Scanner(System.in); ...
- java匿名类_Java匿名类
java匿名类 Java anonymous class are like local class or inner class without a name. We can use java ano ...
最新文章
- c语言精品课程网站论文免费下载,【毕业论文_c语言程序设计精品课程网站的研究与实现6喜欢就下吧材料】...
- 百度智能小程序开源联盟正式成立 小程序开发创业又一新风向标
- boost::posix_time模块实现计算时间段的测试程序
- oracle 增加一个新分区,oracle 11g 新增分区
- 卡尔曼滤波——16.新的均值和方差
- 模型预测控制路径跟踪python语言实现
- 如何安装TreeView控件
- 【数据库原理及应用】——基本表更新(INSERT、UPDATE、ALTER、DELETE)与视图VIEW(学习笔记)
- python查火车票_Python实现12306火车票查询系统
- Three.js修改模型中心点
- IM即时通讯需要解决的问题
- 深入浅出C指针,细节之处见真章,拒绝一切无病呻吟!!!
- 凤凰牌老熊对支付的系统讲解
- 服装内部条码和服装国标码的区别
- Java基础二维数组
- 软件测试真的不好就业吗?
- 使用ONE(一个)API为博客添加每日一句话
- 多元统计分析最短距离法_多元统计分析第10讲(聚类分析:动态聚类)
- FastTunnel Win10内网穿透实现远程桌面
- 2021年MyBatis面试题30道
热门文章
- python中难的算法_Python算法很难吗?python神书《算法图解》PDF电子版分享给你
- jsp测试mysql_Jsp登陆与MySQL对接验证
- python 读取 Excel 文件的方法 csv.reader
- 【数学】Chaarshanbegaan at Cafebazaar
- Vue 计算属性与侦听器
- “” '' ``区别 初学者自用
- [转]Paul Adams:为社交设计
- TOP命令监视系统任务及掩码umask的作用
- 浮动元素的均匀分布和两端对齐
- 侧边菜单栏 android-menudrawer