Java Reference
In-Depth Information
The IEEE remainder,sometimes called the exact remainder is defined
as follows:
When y not equal to 0,the remainder r = x REM y is defined by the
mathematical relation:
rxyn
=−×
where n is the integer nearest to the exact value of x / y . Whenever
x
1
2
n
−=
then n is even. If r = 0 then the sign is that of x . In IEEE 754 precision control
does not apply to the remainder operation.
The method is defined as follows:
public static double IEEEremainder(double f1, double f2)
Computes the remainder operation on two arguments as prescribed by the
IEEE 754 standard. The remainder value is mathematically equal to f 1- f
n , f 1 is the dividend, f 2 is the divisor,and n is the integer closest to the exact
mathematical value of the quotient f 1/ f 2. If two integers are equally close to
f 1/ f 2,then n is the integer that is even. If the remainder is zero,its sign is the
same as the sign of the first argument. The following are special cases:
1. If either argument is NaN,or if the first argument is infinite,or if the second
argument is positive zero or negative zero,then the result is NaN.
2. If the first argument is finite and the second argument is infinite,then the re -
sult is the same as the first argument.
Exponential Function
The Math and StrictMath classes of the java.lang package provide methods
to calculate powers and roots. These include the method pow() that returns
a power function,the method sqrt() that returns the square root of the argu -
ment,and the method exp() which returns the constant e raised to a power.
The methods are as follows:
public static double pow(double a, double b)
Returns the value of the first argument raised to the power of the second ar-
gument,that is,the method calculates a b . Because the exponent argument
is a floating -point value,the pow() method can be used to calculate roots:
Search WWH ::




Custom Search