math 计算float

数学类静态浮点数min(float f1,float f2) (Math Class static float min(float f1 , float f2) )

  • This method is available in java.lang package.

    此方法在java.lang包中可用。

  • This method is used to return the minimum one of both the given arguments or in other words this method returns the smallest value of the given two arguments.

    此方法用于返回给定两个参数中的最小值。换句话说,此方法返回给定两个参数中的最小值。

  • This is a static method so this method is accessible with the class name too.

    这是一个静态方法,因此也可以使用类名访问此方法。

  • The return type of this method is float, it returns the smallest element from the given two arguments.

    此方法的返回类型为float ,它从给定的两个参数返回最小的元素。

  • This method accepts two arguments of float values.

    此方法接受浮点值的两个参数。

  • This method does not throw any exception.

    此方法不会引发任何异常。

Syntax:

句法:

    public static float min(float f1, float f2){
}

Parameter(s): float f1, float f2 – two float values, in which we have to find the smallest/minimum value.

参数: float f1,float f2 –两个浮点值,我们必须在其中找到最小/最小值。

Return value:

返回值:

The return type of this method is float, it returns the smallest/minimum value.

此方法的返回类型为float ,它返回最小值/最小值。

Note:

注意:

  • If we pass "NaN" (Not a Number), it returns the same value i.e. "NaN".

    如果我们传递“ NaN”(不是数字),它将返回相同的值,即“ NaN”。

  • If we pass zero (-0 or 0), it returns the 0.

    如果传递零(-0或0),则返回0。

  • If we pass the same values in both parameters, it returns the same value.

    如果我们在两个参数中传递相同的值,则它将返回相同的值。

Java程序演示min(float f1,float f2)方法的示例 (Java program to demonstrate example of min(float f1, float f2) method)

// Java program to demonstrate the example of
// min(float f1, float f2) method of Math Class.
public class MinFloatTypeMethod {public static void main(String[] args) {// declaring variables
float f1 = -0.0f;
float f2 = 0.0f;
float f3 = -0.6f;
float f4 = 124.58f;
// displaying the values
System.out.println("f1: " + f1);
System.out.println("f2: " + f2);
System.out.println("f3: " + f3);
System.out.println("f4: " + f4);
// Here , we will get (-0.0) because we are passing parameter
// whose value is (-0.0f,0.0f)
System.out.println("Math.min(f1,f2): " + Math.min(f1, f2));
// Here , we will get (0.0) and we are passing parameter
// whose value is (0.0f,124.58f)
System.out.println("Math.min(f2,f4): " + Math.min(f2, f4));
}
}

Output

输出量

E:\Programs>javac MinFloatTypeMethod.java
E:\Programs>java MinFloatTypeMethod
f1: -0.0
f2: 0.0
f3: -0.6
f4: 124.58
Math.min(f1,f2): -0.0
Math.min(f2,f4): 0.0

翻译自: https://www.includehelp.com/java/math-class-static-float-min-float-f1-float-f2-with-example.aspx

math 计算float

math 计算float_Java Math类静态float min(float f1,float f2)与示例相关推荐

  1. expm1_Java Math类静态double expm1(double d)及其示例

    expm1 数学类静态double expm1(double d) (Math Class static double expm1(double d)) This method is availabl ...

  2. java 静态线程_Java线程类静态本机void yield()方法(带示例)

    线程类静态本机无效 yield()软件包java.lang.Thread.yield()中提供了此方法. yield()方法表示停止当前正在执行的线程,并为其他优先级相同的等待线程提供机会. 如果没有 ...

  3. Java Math类静态double ceil(double d)与示例

    数学班双胞胎(double d) (Math Class double ceil(double d)) This method is available in java.lang package. 此 ...

  4. math.pow int_Java Math类static int min(int i1,int i2)与示例

    math.pow int 数学类静态int min(int i1,int i2) (Math Class static int min(int i1 , int i2) ) This method i ...

  5. java float f1=0.5_Java Math类静态float copySign(float f1,float f2)与示例

    数学类float copySign(float f1,float f2)此方法在java.lang包中可用. 此方法用于返回第一个浮点参数以及第二个浮点参数的符号. 这是一个静态方法,因此也可以使用类 ...

  6. divi模板下载_Java Math类静态double IEEEremainder(double divi,double divisor)的示例

    divi模板下载 数学类静态double IEEEremainder(double divi,double divisor) (Math Class static double IEEEremaind ...

  7. java math.cos_Java Math类静态double cos(double d)示例

    java math.cos 数学类静态双cos(double d) (Math Class static double cos(double d)) This method is available ...

  8. java math 类_Java Math类静态长轮(double d)示例

    java math 类 数学课静态长回合(双D) (Math Class static long round(double d) ) This method is available in java. ...

  9. java中的starts_Java Math类静态double nextAfter(double starts,double direction)示例

    java中的starts 数学类静态double nextAfter(双向启动,双向) (Math Class static double nextAfter(double starts , doub ...

最新文章

  1. git ssh创建分支_Git(2):在gitlab中创建开发用户,以及master分支的安全管理
  2. java文件名要和什么一致,Java的类名与文件名必须一致
  3. 使用浏览器console批量更改图片的宽度
  4. EM算法——有隐含变量时,极大似然用梯度法搞不定只好来猜隐含变量期望值求max值了...
  5. 集合框架源码分析三(实现类篇ArrayList,LinkedList,HashMap)
  6. token验证_Swagger中添加Token验证
  7. 【Python】基础总结
  8. 交换二叉树中所有结点的左右子树的位置
  9. (66)UART接口波特率是多少?以及异步采样时钟是多少频率?
  10. react优秀项目案例_2020中国5G+工业互联网大会:鄂州2项目现场签约,2项目入选十大优秀案例...
  11. 集成CCFlow工作流与GPM的办公系统驰骋CCOA介绍(一)
  12. 招聘人才的网站(杭州)
  13. LSTM多输入时间序列预测之股价预测
  14. SpringMVC大体流程框架类图版
  15. 源码编译安装LAMP
  16. Linux软件安装失败问题,source.list用了bionic,实际上我的Linux是focal版本
  17. 51单片机仿真——中断系统(2)
  18. 油脂抵近历史高点,棕榈油认购大涨,CCS05继续向下2022.3.1
  19. 项目经理start法则_开放科学项目的7条经验法则
  20. linux相关使用 --大神掠过

热门文章

  1. kafka如何保证不重复消费又不丢失数据_Kafka写入的数据如何保证不丢失?
  2. JAVA不能满屏_java – 全屏幕视频,不拉伸视频
  3. 从未在一起更让人遗憾_二十不惑强行悲伤结尾,我们本可以在一起,才最让人遗憾...
  4. mysql实体监听器_GitHub - langjiangit/spring-boot-starter-mysql-binlog: mysql的binlog监听器
  5. 计算图片相似度的方法
  6. ngOnInit与constructor的区别
  7. Apache-Flink深度解析-DataStream-Connectors之Kafka
  8. WEB前端面试题汇总整理01
  9. 【iCore4 双核心板_FPGA】例程十一:FSMC总线通信实验——独立地址模式
  10. Linux学习第三步(Centos7安装mysql5.7数据库)