decimal.Decimal.to_integral_exact

Decimal.to_integral_exact(rounding=None, context=None)[source]

Rounds to a nearby integer.

If no rounding mode is specified, take the rounding mode from the context. This method raises the Rounded and Inexact flags when appropriate.

See also: to_integral_value, which does exactly the same as this method except that it doesn’t raise Inexact or Rounded.