Python Glossary Русский

all Python 3Exceptionsexception

decimal.Subnormal

module exceptions

A decimal result is subnormal (its exponent is below Emin).

Syntax

raise decimal.Subnormal

The trap for this signal is off by default, and with the default Emin of -999999 it is practically unreachable — you meet it only after narrowing the context yourself. Subnormal on its own does not mean the result is wrong; it warns that the value dropped below Emin and is now carried with fewer significant digits. Actual loss of value is Underflow: a result that is subnormal and inexact at the same time.

Examples

import decimal
try:
    raise decimal.Subnormal
except decimal.Subnormal as e:
    print(type(e).__name__)   # → Subnormal

See also

Open in the full glossarydocs.python.orgReport an inaccuracy