Decimal-to-integer numerical and exception contracts #
Successful conversions deliver the specified rounded integer. Failure is characterized by non-finiteness or a rounded value outside the destination range. The integer-grid theorems give error and tie guarantees, and the packing theorems show that the checked result survives fixed-width storage exactly.
Every delivered integer, including the invalid default, fits in the chosen destination.
Range is tested after rounding the exact numerical operand.
A successful result denotes the rounded integer exactly.
An integer representable in both source and destination is unchanged with no flags.
Suppression of inexact does not affect the delivered integer.
Inexact is precisely a numerical change on a successful exact-variant conversion.
Invalid integer conversion delivers the documented default, with no simultaneous inexact.
Integer destination conversion never raises floating-point range or division exceptions.
Fixed-width packing preserves the checked integer, including invalid delivery.
Unsigned packing preserves the checked integer exactly, including invalid delivery as zero.