Floating point overflow
suggest changeIf a floating-point operation produces a finite mathematical result outside the finite range of its type, the outcome depends on the values that the type can represent. For a type that supports infinities, as IEC 60559 (IEEE 754) types normally do, the result can be an infinity and the operation is well-defined. If the result is neither representable nor one of the type's infinity or NaN values, the behavior is undefined. Floating-point exceptions and rounding behavior also depend on the implementation and floating-point environment.
float x = 1.0F;
for (int i = 0; i < 10000; i++) {
x *= 10.0F; // Commonly becomes positive infinity on IEC 60559 systems.
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents