Java Reference
In-Depth Information
x
y
x/y
x%y
Finite
±0.0
±
NaN
Finite
±
±0.0
x
±0.0
±0.0
NaN
NaN
±
Finite
±
NaN
±
±
NaN
NaN
Otherwise, floating-point remainder ( % ) acts analogously to integer re-
mainder as described earlier. See the IEEEremainder method in " Math and
StrictMath " on page 657 for a different remainder calculation.
Exercise 9.1 : Write a program that uses the operators + , , * , and / ,
on two infinite operands and show the result. Ensure that you try both
same signed and opposite-signed infinity values.
9.1.3. Strict and Non-Strict Floating-Point Arithmetic
Floating-point arithmetic can be executed in one of two modes: FP-strict
or not FP-strict. For simplicity, we refer to these as strict and non-strict,
respectively. Strict floating-point evaluation follows constrained rules
about exact floating-point operations: When you execute strict floating-
point code you will always get exactly equivalent results on all Java
virtual machine implementations. Floating-point arithmetic that is non-
strict can be executed with somewhat relaxed rules. These rules allow
the use of floating-point representations that may avoid some overflows
Search WWH ::




Custom Search