欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

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

发布时间:2025/3/11 52 豆豆
生活随笔 收集整理的这篇文章主要介绍了 divi模板下载_Java Math类静态double IEEEremainder(double divi,double divisor)的示例 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

divi模板下载

数学类静态double IEEEremainder(double divi,double divisor) (Math Class static double IEEEremainder(double divi , double divisor))

  • This method is available in java.lang package.

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

  • This method is used to return the calculated remainder on the given two parameters.

    此方法用于返回给定两个参数上的计算余数。

  • This method is followed by IEEE 754 Standard.

    IEEE 754标准遵循此方法。

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

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

  • This method accepts two parameters (one is dividend and other is divisor), and it returns the two numbers (one is quotient and other is remainder).

    此方法接受两个参数(一个是除数,另一个是除数),并返回两个数字(一个是商,另一个是余数)。

  • Example: Let suppose if the dividend is fully divisible by divisor then the value of the remainder will be 0 and in that case, the resultant value sign will be the same as the sign of the first argument.

    示例:假设如果除数可被除数完全除,则余数的值将为0,在这种情况下,结果值的符号将与第一个参数的符号相同。

  • The return type of this method is double that means it returns the remainder of the given arguments.

    此方法的返回类型为double,这意味着它将返回给定参数的其余部分。

  • In this method, we pass two parameters as arguments, where, the first argument represents the dividend and the second argument represents the divisor.

    在此方法中,我们将两个参数作为参数传递,其中,第一个参数表示除数,第二个参数表示除数。

  • This method does not throw any exception.

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

Syntax:

句法:

public static double IEEEremainder(double divi, double divisor){}

Parameter(s):

参数:

  • divi – the value of dividend.

    股息 –股息价值。

  • divisor – the value of divisor.

    除数 – 除数的值。

Return value:

返回值:

The return type of this method is double, it returns the remainder.

此方法的返回类型为double ,它返回余数。

Note:

注意:

  • If we pass any argument "NaN", it returns the "NaN".

    如果我们传递任何参数“ NaN”,它将返回“ NaN”。

  • If we pass any argument as an infinity, it returns the "NaN".

    如果我们将任何参数传递为无穷大,它将返回“ NaN”。

  • If we pass any argument as 0 (-0 or 0), it returns the "NaN".

    如果我们将任何参数传递为0(-0或0),它将返回“ NaN”。

  • If we pass a finite value as a first argument and an infinite value as second argument, it returns the first argument.

    如果我们将一个有限值作为第一个参数传递而将一个无限值作为第二个参数传递,它将返回第一个参数。

Java程序演示IEEEremainder(double divi,double divisor)方法的示例 (Java program to demonstrate example of IEEEremainder(double divi , double divisor) method)

// Java program to demonstrate the example of // IEEEremainder(double divi, double divisor) method of Math Classpublic class IEEEremainderMethod {public static void main(String[] args) {// variables declarationsDouble d1 = 7.0 / 0.0;Double d2 = 10.0;Double d3 = 5.0;Double d4 = 0.0;Double d5 = -0.0;// displaying valuesSystem.out.println("d1: " + d1);System.out.println("d2: " + d2);System.out.println("d3: " + d3);System.out.println("d4: " + d4);System.out.println("d5: " + d5);// Here , we will get (NaN) because we are passing // first parameter whose value is (infinity)System.out.println("Math.IEEEremainder (d1,d2): " + Math.IEEEremainder(d1, d2));// Here , we will get (NaN) because we are passing // second parameter whose value is (positive or negative 0)System.out.println("Math.IEEEremainder (d2,d4): " + Math.IEEEremainder(d2, d4));// Here , we will get (first argument) because we are passing // finite parameter as first argument whose value is (10.0) and // passing infinity as second argument in the method.System.out.println("Math.IEEEremainder (d2,d1): " + Math.IEEEremainder(d2, d1));// Here , we will get (0.0) because we are passing // parameter whose value is (10.0,5.0)System.out.println("Math.IEEEremainder (d2,d3): " + Math.IEEEremainder(d2, d3));} }

Output

输出量

E:\Programs>javac HypotMethod.javaE:\Programs>java HypotMethod d1: Infinity d2: 10.0 d3: 5.0 d4: 0.0 d5: -0.0 Math.IEEEremainder (d1,d2): NaN Math.IEEEremainder (d2,d4): NaN Math.IEEEremainder (d2,d1): 10.0 Math.IEEEremainder (d2,d3): 0.0

翻译自: https://www.includehelp.com/java/math-class-static-double-ieeeremainder-double-divi-double-divisor-with-example.aspx

divi模板下载

总结

以上是生活随笔为你收集整理的divi模板下载_Java Math类静态double IEEEremainder(double divi,double divisor)的示例的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。