目录

static double IEEEremainder(double f1, double f2)

描述 (Description)

java.lang.Math.IEEEremainder(double f1, double f2)返回计算IEEE 754标准规定的两个参数上的余数运算。 余数值在数学上等于f1-f2 xn,其中n是最接近商f1/f2的精确数学值的数学整数,并且如果两个数学整数同等地接近f1/f2,则n是整数,甚至。 如果余数为零,则其符号与第一个参数的符号相同。 特殊情况 -

  • 如果任一参数为NaN,或者第一个参数为无穷大,或者第二个参数为正零或负零,则结果为NaN。

  • 如果第一个参数是有限的,第二个参数是无限的,那么结果与第一个参数相同。

声明 (Declaration)

以下是java.lang.Math.IEEEremainder()方法的声明

public static double IEEEremainder(double f1, double f2)

参数 (Parameters)

  • f1 - 股息。

  • f2 - 除数。

返回值 (Return Value)

当f1除以f2时,此方法返回余数。

异常 (Exception)

NA

例子 (Example)

以下示例显示了lang.Math.IEEEremainder()方法的用法。

package com.iowiki;
import java.lang.*;
public class MathDemo {
   public static void main(String[] args) {
      // get two double numbers
      double x = 60984.1;
      double y = -497.99;
      // get the remainder when x/y
      System.out.println("Math.IEEEremainder(" + x + "," + y + ")="
         + Math.IEEEremainder(x, y));
      // get the remainder when y/x
      System.out.println("Math.IEEEremainder(" + y + "," + x + ")="
         + Math.IEEEremainder(y, x));
   }
}

让我们编译并运行上面的程序,这将产生以下结果 -

Math.IEEEremainder(60984.1, -497.99)=229.31999999999744
Math.IEEEremainder(-497.99, 60984.1)=-497.99
↑回到顶部↑
WIKI教程 @2018