Struct decstr::Bitstring128

source ·
pub struct Bitstring128(_);
Expand description

Implementations§

source§

impl Bitstring128

Basic mathematical constants.

source

pub const ZERO: Self = _

0

source

pub const ONE: Self = _

1

source

pub const NEG_ONE: Self = _

-1

source

pub const PI: Self = _

Archimedes’ constant (π)

source

pub const TAU: Self = _

The full circle constant (τ)

Equal to 2π.

source

pub const FRAC_PI_2: Self = _

π/2

source

pub const FRAC_PI_3: Self = _

π/3

source

pub const FRAC_PI_4: Self = _

π/4

source

pub const FRAC_PI_6: Self = _

π/6

source

pub const FRAC_PI_8: Self = _

π/8

source

pub const FRAC_1_PI: Self = _

1/π

source

pub const FRAC_2_PI: Self = _

2/π

source

pub const FRAC_2_SQRT_PI: Self = _

2/sqrt(π)

source

pub const SQRT_2: Self = _

sqrt(2)

source

pub const FRAC_1_SQRT_2: Self = _

1/sqrt(2)

source

pub const E: Self = _

Euler’s number (e)

source

pub const LOG2_10: Self = _

log2(10)

source

pub const LOG2_E: Self = _

log2(e)

source

pub const LOG10_2: Self = _

log10(2)

source

pub const LOG10_E: Self = _

log10(e)

source

pub const LN_2: Self = _

ln(2)

source

pub const LN_10: Self = _

ln(10)

source§

impl Bitstring128

source

pub const RADIX: u32 = 10u32

The radix or base of the internal representation.

source

pub const DIGITS: u32 = 34u32

The number of digits in base 10 that can be represented without loss of precision.

This constant indicates the total count of significant decimal digits in the significand, regardless of the decimal point’s position. For instance 1234567 and 123.4567, both contain DIGITS digits.

source

pub const EPSILON: Self = _

Machine epsilon value.

This is the difference between 1.0 and the next larger representable number.

source

pub const MIN: Self = _

Smallest finite value.

source

pub const MIN_POSITIVE: Self = _

Smallest positive normal value.

source

pub const MAX: Self = _

Largest finite value.

source

pub const MIN_10_EXP: i32 = -6_176i32

Minimum possible normal power of 10 exponent.

source

pub const MAX_10_EXP: i32 = 6_111i32

Maximum possible normal power of 10 exponent.

source

pub const NAN: Self = _

Not a Number (NaN), with a zero payload.

source

pub const INFINITY: Self = _

Infinity (∞).

source

pub const NEG_INFINITY: Self = _

Negative infinity (−∞).

source§

impl Bitstring128

source

pub const fn from_le_bytes(bytes: [u8; 16]) -> Self

Create a decimal from its representation as a byte array in little endian.

This matches the internal byte representation of the decimal, regardless of the platform.

source

pub const fn from_be_bytes(bytes: [u8; 16]) -> Self

Create a decimal from its representation as a byte array in big endian.

source

pub const fn as_le_bytes(&self) -> &[u8; 16]

Return the memory representation of this decimal as a byte array in little-endian byte order.

This matches the internal byte representation of the decimal, regardless of the platform.

source

pub const fn to_be_bytes(&self) -> [u8; 16]

Return the memory representation of this decimal as a byte array in big-endian (network) byte order.

source

pub fn zero() -> Self

Create a decimal with the finite value zero.

source

pub fn max() -> Self

Create a decimal with its maximum finite value.

source

pub fn min() -> Self

Create a decimal with its minimum finite value.

source

pub fn min_positive() -> Self

Create a decimal with its minimum positive non-zero value.

source§

impl Bitstring128

source

pub fn is_sign_negative(&self) -> bool

Whether or not the sign bit is set.

source

pub fn is_finite(&self) -> bool

Whether or not the decimal is a finite number.

source

pub fn is_infinite(&self) -> bool

Whether or not the decimal is an infinity.

source

pub fn is_nan(&self) -> bool

Whether the decimal is not a NaN.

source

pub fn is_quiet_nan(&self) -> bool

Whether the decimal is a qNaN.

source

pub fn is_signaling_nan(&self) -> bool

Whether the decimal is a sNaN.

source§

impl Bitstring128

source

pub fn try_parse_str(s: &str) -> Result<Bitstring128, Error>

Try parse a decimal from a string.

This method is more efficient than try_parse if you already have a string to parse.

source

pub fn try_parse(n: impl Display) -> Result<Bitstring128, Error>

Try parse a decimal from some formattable value.

This method can avoid needing to buffer an entire number upfront.

source§

impl Bitstring128

source

pub fn from_f32(f: f32) -> Bitstring128

Convert a binary floating point into a decimal.

source§

impl Bitstring128

source

pub fn from_f64(f: f64) -> Bitstring128

Convert a binary floating point into a decimal.

source§

impl Bitstring128

source

pub fn to_f32(&self) -> Option<f32>

Try convert a decimal into a binary floating point.

source§

impl Bitstring128

source

pub fn to_f64(&self) -> Option<f64>

Try convert a decimal into a binary floating point.

source§

impl Bitstring128

source

pub fn from_i8(i: i8) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_i16(i: i16) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_i32(i: i32) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_i64(i: i64) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_i128(i: i128) -> Option<Bitstring128>

Try convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn to_i8(&self) -> Option<i8>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_i16(&self) -> Option<i16>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_i32(&self) -> Option<i32>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_i64(&self) -> Option<i64>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_i128(&self) -> Option<i128>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn from_u8(i: u8) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_u16(i: u16) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_u32(i: u32) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_u64(i: u64) -> Bitstring128

Convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn from_u128(i: u128) -> Option<Bitstring128>

Try convert an integer into a decimal.

source§

impl Bitstring128

source

pub fn to_u8(&self) -> Option<u8>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_u16(&self) -> Option<u16>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_u32(&self) -> Option<u32>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_u64(&self) -> Option<u64>

Try convert a decimal into an integer.

source§

impl Bitstring128

source

pub fn to_u128(&self) -> Option<u128>

Try convert a decimal into an integer.

Trait Implementations§

source§

impl Clone for Bitstring128

source§

fn clone(&self) -> Bitstring128

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Bitstring128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Bitstring128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<f32> for Bitstring128

source§

fn from(f: f32) -> Bitstring128

Converts to this type from the input type.
source§

impl From<f64> for Bitstring128

source§

fn from(f: f64) -> Bitstring128

Converts to this type from the input type.
source§

impl From<i16> for Bitstring128

source§

fn from(i: i16) -> Bitstring128

Converts to this type from the input type.
source§

impl From<i32> for Bitstring128

source§

fn from(i: i32) -> Bitstring128

Converts to this type from the input type.
source§

impl From<i64> for Bitstring128

source§

fn from(i: i64) -> Bitstring128

Converts to this type from the input type.
source§

impl From<i8> for Bitstring128

source§

fn from(i: i8) -> Bitstring128

Converts to this type from the input type.
source§

impl From<u16> for Bitstring128

source§

fn from(i: u16) -> Bitstring128

Converts to this type from the input type.
source§

impl From<u32> for Bitstring128

source§

fn from(i: u32) -> Bitstring128

Converts to this type from the input type.
source§

impl From<u64> for Bitstring128

source§

fn from(i: u64) -> Bitstring128

Converts to this type from the input type.
source§

impl From<u8> for Bitstring128

source§

fn from(i: u8) -> Bitstring128

Converts to this type from the input type.
source§

impl FromStr for Bitstring128

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Bitstring128, Self::Err>

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

impl<'a> TryFrom<&'a str> for Bitstring128

§

type Error = Error

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

fn try_from(s: &'a str) -> Result<Bitstring128, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for f32

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<f32, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for f64

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<f64, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for i128

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<i128, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for i16

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<i16, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for i32

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<i32, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for i64

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<i64, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for i8

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<i8, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for u128

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<u128, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for u16

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<u16, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for u32

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<u32, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for u64

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<u64, Self::Error>

Performs the conversion.
source§

impl TryFrom<Bitstring128> for u8

§

type Error = Error

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

fn try_from(d: Bitstring128) -> Result<u8, Self::Error>

Performs the conversion.
source§

impl TryFrom<i128> for Bitstring128

§

type Error = Error

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

fn try_from(i: i128) -> Result<Bitstring128, Self::Error>

Performs the conversion.
source§

impl TryFrom<u128> for Bitstring128

§

type Error = Error

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

fn try_from(i: u128) -> Result<Bitstring128, Self::Error>

Performs the conversion.
source§

impl Copy for Bitstring128

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.