Built-in Exceptions

FloatingPointError — exception class

Names a floating-point arithmetic failure. Standard Python floating arithmetic does not generally raise this class automatically; numerical libraries may raise it under configured error policies. Do not expect all infinities or NaNs to trigger it. The example raises a controlled stand-in to demonstrate handling; it does not cause the real system failure. Catch FloatingPointError when this category is the recovery boundary; do not rely on the exact human-readable message.

Formal Syntax & Structure

python syntaxpython
FloatingPointError

Return Value

type

The class object FloatingPointError; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
try:    raise FloatingPointError("simulated invalid floating operation")except FloatingPointError as error:    print(type(error).__name__)
Python Reference