Struct num_bigfloat::BigFloat
source · [−]pub struct BigFloat { /* private fields */ }
Expand description
Number representation.
Implementations
sourceimpl BigFloat
impl BigFloat
sourcepub fn from_bytes(bytes: &[u8], sign: i8, exponent: i8) -> BigFloat
pub fn from_bytes(bytes: &[u8], sign: i8, exponent: i8) -> BigFloat
Create a BigFloat value from a sequence of bytes
. Each byte must represent a decimal digit.
First byte is the most significant. The length of bytes
can be any. If the length of
bytes
is greater than required, then the remaining part is ignored.
If sign
is negative, then the resulting BigFloat will be
negative.
sourcepub fn get_mantissa_bytes(&self, bytes: &mut [u8])
pub fn get_mantissa_bytes(&self, bytes: &mut [u8])
Get BigFloat’s mantissa as bytes. Each byte represents a decimal digit.
First byte is the most significant. The length of bytes
can be any. If the length of
bytes
is smaller than required, then remaining part of mantissa will be omitted.
The length of mantissa can be determined using get_mantissa_len
.
sourcepub fn get_mantissa_len(&self) -> usize
pub fn get_mantissa_len(&self) -> usize
Return the number of decimal positions filled in the mantissa.
sourcepub fn get_exponent(&self) -> i8
pub fn get_exponent(&self) -> i8
Return exponent part.
sourcepub fn add(&self, d2: &BigFloat) -> Result<BigFloat, Error>
pub fn add(&self, d2: &BigFloat) -> Result<BigFloat, Error>
Add d2 and return result of addition.
Errors
ExponentOverflow - in case of too big or too small numbers.
sourcepub fn sub(&self, d2: &BigFloat) -> Result<BigFloat, Error>
pub fn sub(&self, d2: &BigFloat) -> Result<BigFloat, Error>
Subtract d2 and return result of subtraction.
Errors
ExponentOverflow - in case of too big or too small numbers.
sourcepub fn mul(&self, d2: &BigFloat) -> Result<BigFloat, Error>
pub fn mul(&self, d2: &BigFloat) -> Result<BigFloat, Error>
Multiply by d2 and return result of multiplication.
Errors
ExponentOverflow - in case of too big or too small numbers.
sourcepub fn div(&self, d2: &BigFloat) -> Result<BigFloat, Error>
pub fn div(&self, d2: &BigFloat) -> Result<BigFloat, Error>
Divide by d2 and return result of division.
Errors
ExponentOverflow - in case of too big or too small numbers. DivisionByZero - in case of d2 equal to zero.
sourcepub fn cmp(&self, d2: &BigFloat) -> i16
pub fn cmp(&self, d2: &BigFloat) -> i16
Compare to d2. Returns positive if self > d2, negative if self < d2, 0 otherwise.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BigFloat
impl Send for BigFloat
impl Sync for BigFloat
impl Unpin for BigFloat
impl UnwindSafe for BigFloat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more