pub struct DecContext {
pub digits: i32,
pub emax: i32,
pub emin: i32,
pub round: Rounding,
pub traps: u32,
pub status: u32,
pub clamp: u8,
}Expand description
Context for operations.
Fields§
§digits: i32Working precision.
emax: i32Maximum positive exponent.
emin: i32Minimum negative exponent.
round: RoundingRounding mode.
traps: u32Trap-enabler flags.
status: u32Status flags.
clamp: u8Flag: apply IEEE exponent clamp.
Implementations§
Source§impl DecContext
impl DecContext
Sourcepub fn dec_context_clear_status(
context: &mut DecContext,
mask: u32,
) -> &DecContext
pub fn dec_context_clear_status( context: &mut DecContext, mask: u32, ) -> &DecContext
Clear bits in current status.
dec_context_clear_status - clear bits in current status.
context is the context structure to be queried.
mask indicates the bits to be cleared (the status bit that corresponds
to each 1 bit in the mask is cleared).
Returns updated context.
No error is possible.
Sourcepub fn dec_context_default(context: &mut DecContext, kind: i32) -> &DecContext
pub fn dec_context_default(context: &mut DecContext, kind: i32) -> &DecContext
Initializes a context structure.
dec_context_default - initialize a context structure.
context is the structure to be initialized.
kind selects the required set of default values, one of:
- DEC_INIT_BASE - select ANSI X3-274 defaults
- DEC_INIT_DECIMAL32 - select IEEE 754 defaults, 32-bit
- DEC_INIT_DECIMAL64 - select IEEE 754 defaults, 64-bit
- DEC_INIT_DECIMAL128 - select IEEE 754 defaults, 128-bit
For any other value a valid context is returned, but with Invalid_operation set in the status field.
Returns a context structure with the appropriate initial values.
Sourcepub fn dec_context_get_rounding(context: &DecContext) -> Rounding
pub fn dec_context_get_rounding(context: &DecContext) -> Rounding
Returns current rounding mode.
dec_context_get_rounding - return current rounding mode.
context is the context structure to be queried.
Returns the rounding mode.
No error is possible.
Sourcepub fn dec_context_set_status(
context: &mut DecContext,
status: u32,
) -> &DecContext
pub fn dec_context_set_status( context: &mut DecContext, status: u32, ) -> &DecContext
Sets status and raises trap if appropriate.
dec_context_set_status - set status and raise trap if appropriate.
context is the context structure to be updated.
status is the error code.
Returns the context structure with updated status.
Control may never return from this routine, if there is a signal handler and it panics.