DecContext

Struct DecContext 

Source
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: i32

Working precision.

§emax: i32

Maximum positive exponent.

§emin: i32

Minimum negative exponent.

§round: Rounding

Rounding mode.

§traps: u32

Trap-enabler flags.

§status: u32

Status flags.

§clamp: u8

Flag: apply IEEE exponent clamp.

Implementations§

Source§

impl DecContext

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for DecContext

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.