Struct decimal::d128 [] [src]

#[repr(C)]
pub struct d128 { /* fields omitted */ }

A 128-bit decimal floating point type.

Methods

impl d128
[src]

Creates a d128 from raw bytes. Endianess is host dependent.

Returns raw bytes for this d128. Endianess is host dependent.

Returns the thread local status.

Sets the thread local status.

Reads the hex binary representation from a string. This is the reverse of formatting with {:x}.

Returns the d128 representing +0.

Returns the absolute value of self.

Calculates the fused multiply-add self × a + b and returns the result. The multiply is carried out first and is exact, so this operation has only the one, final, rounding.

Returns the adjusted exponent of self, according to IEEE 754 rules. That is, the exponent returned is calculated as if the decimal point followed the first significant digit (so, for example, if self were 123 then the result would be 2). If self is infinite, the result is +Infinity. If self is a zero, the result is –Infinity, and the DIVISION_BY_ZERO flag is set. If self is less than zero, the absolute value of self is used. If self is 1, the result is 0. NaNs are handled (propagated) as for arithmetic operations.

If both self and other are numeric (not NaNs) this returns the larger of the two (compared using total ordering, to give a well-defined result). If either (but not both of) is a quiet NaN then the other argument is the result; otherwise NaNs are handled as for arithmetic operations.

If both self and other are numeric (not NaNs) this returns the smaller of the two (compared using total ordering, to give a well-defined result). If either (but not both of) is a quiet NaN then the other argument is the result; otherwise NaNs are handled as for arithmetic operations.

Returns the ‘next’ d128 to self in the direction of +Infinity according to IEEE 754 rules for nextUp. The only status possible is INVALID_OPERATION (from an sNaN).

Returns the ‘next’ d128 to self in the direction of –Infinity according to IEEE 754 rules for nextDown. The only status possible is INVALID_OPERATION (from an sNaN).

The number is set to the result of raising self to the power of exp. Results will be exact when exp has an integral value and the result does not need to be rounded, and also will be exact in certain special cases, such as when self is a zero (see the arithmetic specification for details). Inexact results will always be full precision, and will almost always be correctly rounded, but may be up to 1 ulp (unit in last place) in error in rare cases. This is a mathematical function; the 106 restrictions on precision and range apply as described above, except that the normal range of values is allowed if exp has an integral value in the range –1999999997 through +999999999.

The number is set to e raised to the power of exp. Finite results will always be full precision and inexact, except when exp is a zero or –Infinity (giving 1 or 0 respectively). Inexact results will almost always be correctly rounded, but may be up to 1 ulp (unit in last place) in error in rare cases. This is a mathematical function; the 106 restrictions on precision and range apply as described above.

The number is set to the natural logarithm (logarithm in base e) of self. self must be positive or a zero. Finite results will always be full precision and inexact, except when self is equal to 1, which gives an exact result of 0. Inexact results will almost always be correctly rounded, but may be up to 1 ulp (unit in last place) in error in rare cases. This is a mathematical function; the 106 restrictions on precision and range apply as described above.

The number is set to the logarithm in base ten of self. self must be positive or a zero. Finite results will always be full precision and inexact, except when self is equal to an integral power of ten, in which case the result is the exact integer. Inexact results will almost always be correctly rounded, but may be up to 1 ulp (unit in last place) in error in rare cases. This is a mathematical function; the 106 restrictions on precision and range apply as described above.

Returns the ‘next’ d128 to self in the direction of other according to proposed IEEE 754 rules for nextAfter. If self == other the result is self. If either operand is a NaN the result is as for arithmetic operations. Otherwise (the operands are numeric and different) the result of adding (or subtracting) an infinitesimal positive amount to self and rounding towards +Infinity (or –Infinity) is returned, depending on whether other is larger (or smaller) than self. The addition will set flags, except that if the result is normal (finite, non-zero, and not subnormal) no flags are set.

Returns self set to have the same quantum as other, if possible (that is, numerically the same value but rounded or padded if necessary to have the same exponent as other, for example to round a monetary quantity to cents).

Returns a copy of self with its coefficient reduced to its shortest possible form without changing the value of the result. This removes all possible trailing zeros from the coefficient (some may remain when the number is very close to the most positive or most negative number). Infinities and NaNs are unchanged and no status is set unless self is an sNaN. If self is a zero the result exponent is 0.

The result is a copy of self with the digits of the coefficient rotated to the left (if amount is positive) or to the right (if amount is negative) without adjusting the exponent or the sign of self. amount is the count of positions to rotate and must be a finite integer (with exponent=0) in the range -34 through +34. NaNs are propagated as usual. If self is infinite the result is Infinity of the same sign. No status is set unless amount is invalid or an operand is an sNaN.

This calculates self × 10other and returns the result. other must be an integer (finite with exponent=0) in the range ±2 × (34 + 6144), typically resulting from logb. Underflow and overflow might occur. NaNs propagate as usual.

Compares self and other numerically and returns the result. The result may be –1, 0, 1, or NaN (unordered); –1 indicates that self is less than other, 0 indicates that they are numerically equal, and 1 indicates that self is greater than other. NaN is returned only if self or other is a NaN.

Compares self and other using the IEEE 754 total ordering (which takes into account the exponent) and returns the result. No status is set (a signaling NaN is ordered between Infinity and NaN). The result will be –1, 0, or 1.

Returns self ensuring that the encoding is canonical.

Returns the class of self.

Same as class() but returns std::num::FpCategory.

Returns the number of significant digits in self. If self is a zero or is infinite, 1 is returned. If self is a NaN then the number of digits in the payload is returned.

Returns true if the encoding of self is canonical, or false otherwise.

Returns true if self is neither infinite nor a NaN, or false otherwise.

Returns true if self is finite and its exponent is zero, or false otherwise.

Returns true if self is a valid argument for logical operations (that is, self is zero or positive, an integer (finite with a zero exponent) and comprises only zeros and/or ones), or false otherwise.

Returns true if the encoding of self is an infinity, or false otherwise.

Returns true if self is a NaN (quiet or signaling), or false otherwise.

Returns true if self is less than zero and not a NaN, or false otherwise.

Returns true if self is a normal number (that is, is finite, non-zero, and not subnormal), or false otherwise.

Returns true if self is greater than zero and not a NaN, or false otherwise.

Returns true if self is a signaling NaN, or false otherwise.

Returns true if self has a minus sign, or false otherwise. Note that zeros and NaNs may have a minus sign.

Returns true if self is subnormal (that is, finite, non-zero, and with magnitude less than 10-6143), or false otherwise.

Returns true if self is zero, or false otherwise.

Trait Implementations

impl Clone for d128
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for d128
[src]

impl Default for d128
[src]

Returns the "default value" for a type. Read more

impl OrdSubset for d128
[src]

impl Into<OrdVar<d128>> for d128
[src]

Performs the conversion.

impl Decodable for d128
[src]

Deserialize a value using a Decoder.

impl Encodable for d128
[src]

Serialize a value using an Encoder.

impl Hash for d128
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Serialize for d128
[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for d128
[src]

Deserialize this value from the given Serde deserializer. Read more

impl From<i32> for d128
[src]

Converts an i32 to d128. The result is exact and no error is possible.

Performs the conversion.

impl From<u32> for d128
[src]

Converts an u32 to d128. The result is exact and no error is possible.

Performs the conversion.

impl From<u64> for d128
[src]

Converts an u64 to d128. The result is exact and no error is possible.

Performs the conversion.

impl From<i64> for d128
[src]

Converts an i64 to d128. The result is exact and no error is possible.

Performs the conversion.

impl AsRef<d128> for d128
[src]

Performs the conversion.

impl FromStr for d128
[src]

Converts a string to d128. The length of the coefficient and the size of the exponent are checked by this routine, so rounding will be applied if necessary, and this may set status flags (UNDERFLOW, OVERFLOW) will be reported, or rounding applied, as necessary. There is no limit to the coefficient length for finite inputs; NaN payloads must be integers with no more than 33 digits. Exponents may have up to nine significant digits. The syntax of the string is fully checked; if it is not valid, the result will be a quiet NaN and an error flag will be set.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl Into<i32> for d128
[src]

Converts this d128 to an i32. It uses Rounding::HalfEven.

Performs the conversion.

impl Into<u32> for d128
[src]

Converts this d128 to an u32. It uses Rounding::HalfEven.

Performs the conversion.

impl Display for d128
[src]

Formats a d128. Finite numbers will be converted to a string with exponential notation if the exponent is positive or if the magnitude of x is less than 1 and would require more than five zeros between the decimal point and the first significant digit. Note that strings which are not simply numbers (one of Infinity, –Infinity, NaN, or sNaN) are possible. A NaN string may have a leading – sign and/or following payload digits. No digits follow the NaN string if the payload is 0.

Formats the value using the given formatter. Read more

impl Debug for d128
[src]

Same as fmt::Display.

Formats the value using the given formatter.

impl LowerExp for d128
[src]

Formats a d128 with engineering notation. This is the same as fmt::Display except that if exponential notation is used the exponent will be a multiple of 3.

Formats the value using the given formatter.

impl LowerHex for d128
[src]

Formats a d128 to hexadecimal binary representation.

Formats the value using the given formatter.

impl PartialEq<d128> for d128
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialOrd<d128> for d128
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Add<d128> for d128
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a> Add<d128> for &'a d128
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a> Add<&'a d128> for d128
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b> Add<&'a d128> for &'b d128
[src]

The resulting type after applying the + operator

The method for the + operator

impl Sub<d128> for d128
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a> Sub<d128> for &'a d128
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a> Sub<&'a d128> for d128
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b> Sub<&'a d128> for &'b d128
[src]

The resulting type after applying the - operator

The method for the - operator

impl Mul<d128> for d128
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a> Mul<d128> for &'a d128
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a> Mul<&'a d128> for d128
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b> Mul<&'a d128> for &'b d128
[src]

The resulting type after applying the * operator

The method for the * operator

impl Div<d128> for d128
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a> Div<d128> for &'a d128
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a> Div<&'a d128> for d128
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, 'b> Div<&'a d128> for &'b d128
[src]

The resulting type after applying the / operator

The method for the / operator

impl BitAnd<d128> for d128
[src]

The operands must be zero or positive, an integer (finite with zero exponent) and comprise only zeros and/or ones; if not, INVALID_OPERATION is set.

The resulting type after applying the & operator

The method for the & operator

impl<'a> BitAnd<d128> for &'a d128
[src]

The resulting type after applying the & operator

The method for the & operator

impl<'a> BitAnd<&'a d128> for d128
[src]

The resulting type after applying the & operator

The method for the & operator

impl<'a, 'b> BitAnd<&'a d128> for &'b d128
[src]

The resulting type after applying the & operator

The method for the & operator

impl BitOr<d128> for d128
[src]

The operands must be zero or positive, an integer (finite with zero exponent) and comprise only zeros and/or ones; if not, INVALID_OPERATION is set.

The resulting type after applying the | operator

The method for the | operator

impl<'a> BitOr<d128> for &'a d128
[src]

The resulting type after applying the | operator

The method for the | operator

impl<'a> BitOr<&'a d128> for d128
[src]

The resulting type after applying the | operator

The method for the | operator

impl<'a, 'b> BitOr<&'a d128> for &'b d128
[src]

The resulting type after applying the | operator

The method for the | operator

impl BitXor<d128> for d128
[src]

The operands must be zero or positive, an integer (finite with zero exponent) and comprise only zeros and/or ones; if not, INVALID_OPERATION is set.

The resulting type after applying the ^ operator

The method for the ^ operator

impl<'a> BitXor<d128> for &'a d128
[src]

The resulting type after applying the ^ operator

The method for the ^ operator

impl<'a> BitXor<&'a d128> for d128
[src]

The resulting type after applying the ^ operator

The method for the ^ operator

impl<'a, 'b> BitXor<&'a d128> for &'b d128
[src]

The resulting type after applying the ^ operator

The method for the ^ operator

impl Rem<d128> for d128
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a> Rem<d128> for &'a d128
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a> Rem<&'a d128> for d128
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a, 'b> Rem<&'a d128> for &'b d128
[src]

The resulting type after applying the % operator

The method for the % operator

impl AddAssign<d128> for d128
[src]

The method for the += operator

impl SubAssign<d128> for d128
[src]

The method for the -= operator

impl MulAssign<d128> for d128
[src]

The method for the *= operator

impl DivAssign<d128> for d128
[src]

The method for the /= operator

impl BitAndAssign<d128> for d128
[src]

The method for the &= operator

impl BitOrAssign<d128> for d128
[src]

The method for the |= operator

impl BitXorAssign<d128> for d128
[src]

The method for the ^= operator

impl RemAssign<d128> for d128
[src]

The method for the %= operator

impl Neg for d128
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<'a> Neg for &'a d128
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl Not for d128
[src]

The operand must be zero or positive, an integer (finite with zero exponent) and comprise only zeros and/or ones; if not, INVALID_OPERATION is set.

The resulting type after applying the ! operator

The method for the unary ! operator

impl<'a> Not for &'a d128
[src]

The resulting type after applying the ! operator

The method for the unary ! operator

impl Shl<usize> for d128
[src]

The result is self with the digits of the coefficient shifted to the left without adjusting the exponent or the sign of self. Any digits ‘shifted in’ from the right will be 0. amount is the count of positions to shift and must be a in the range –34 through +34. NaNs are propagated as usual. If self is infinite the result is Infinity of the same sign. No status is set unless amount is invalid or self is an sNaN.

The resulting type after applying the << operator

The method for the << operator

impl<'a> Shl<usize> for &'a d128
[src]

The resulting type after applying the << operator

The method for the << operator

impl ShlAssign<usize> for d128
[src]

The method for the <<= operator

impl Shr<usize> for d128
[src]

The result is self with the digits of the coefficient shifted to the right without adjusting the exponent or the sign of self. Any digits ‘shifted in’ from the left will be 0. amount is the count of positions to shift and must be a in the range –34 through +34. NaNs are propagated as usual. If self is infinite the result is Infinity of the same sign. No status is set unless amount is invalid or self is an sNaN.

The resulting type after applying the >> operator

The method for the >> operator

impl<'a> Shr<usize> for &'a d128
[src]

The resulting type after applying the >> operator

The method for the >> operator

impl ShrAssign<usize> for d128
[src]

The method for the >>= operator