Constants
pyfxp.constants
Fixed-point arithmetic constants.
Attributes:
| Name | Type | Description |
|---|---|---|
TRUNC |
Bit truncation. Rounds toward negative infinity. |
|
CEIL |
Round toward positive infinity. |
|
TO_ZERO |
Round toward zero. |
|
AWAY |
Round away from zero. |
|
HALF_UP |
Round to nearest; ties round toward positive infinity. |
|
HALF_DOWN |
Round to nearest; ties round toward negative infinity. |
|
HALF_EVEN |
Round to nearest; ties to even. |
|
HALF_ZERO |
Round to nearest; ties toward zero. |
|
HALF_AWAY |
Round to nearest; ties away from zero. |
|
WRAP |
Overflow wraps around. |
|
SAT |
Overflow saturates to max/min representable value. |
|
ERROR |
Overflow raises an error. |
|
rounding_modes |
Dictionary mapping rounding mode names to their numeric codes. |
|
overflow_modes |
Dictionary mapping overflow mode names to their numeric codes. |
|
rounding_modes_inv |
Inverse mapping of rounding mode codes to names. |
|
overflow_modes_inv |
Inverse mapping of overflow mode codes to names. |
rounding_modes
module-attribute
rounding_modes = {
"TRUNC": TRUNC,
"CEIL": CEIL,
"TO_ZERO": TO_ZERO,
"AWAY": AWAY,
"HALF_UP": HALF_UP,
"HALF_DOWN": HALF_DOWN,
"HALF_EVEN": HALF_EVEN,
"HALF_ZERO": HALF_ZERO,
"HALF_AWAY": HALF_AWAY,
}
Dictionary mapping rounding mode names to their numeric codes.
overflow_modes
module-attribute
Dictionary mapping overflow mode names to their numeric codes.
rounding_modes_inv
module-attribute
Inverse mapping of rounding mode codes to names.