Struct astro_float::BigFloat

source ·
pub struct BigFloat { /* private fields */ }
Expand description

A floating point number of arbitrary precision.

Implementations§

source§

impl BigFloat

source

pub fn new(p: usize) -> BigFloat

Returns a new number with value of 0 and precision of p bits. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn from_f64(f: f64, p: usize) -> BigFloat

Constructs a number with precision p from f64 value. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn nan(err: Option<Error>) -> BigFloat

Constructs not-a-number with an associated error err.

source

pub fn from_f32(f: f32, p: usize) -> BigFloat

Constructs a number with precision p from f32 value. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn is_inf_pos(&self) -> bool

Returns true if self is positive infinity.

source

pub fn is_inf_neg(&self) -> bool

Returns true if self is negative infinity.

source

pub fn is_inf(&self) -> bool

Returns true if self is infinite.

source

pub fn is_nan(&self) -> bool

Return true if self is not a number.

source

pub fn is_int(&self) -> bool

Return true if self is an integer number.

source

pub fn err(&self) -> Option<Error>

Returns the associated with NaN error, if any.

source

pub fn add(&self, d2: &BigFloat, p: usize, rm: RoundingMode) -> BigFloat

Adds d2 to self and returns the result of the operation with precision p rounded according to rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn add_full_prec(&self, d2: &BigFloat) -> BigFloat

Adds d2 to self and returns the result of the operation. The resulting precision is equal to the full precision of the result. This operation can be used to emulate integer addition.

source

pub fn sub(&self, d2: &BigFloat, p: usize, rm: RoundingMode) -> BigFloat

Subtracts d2 from self and returns the result of the operation with precision p rounded according to rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn sub_full_prec(&self, d2: &BigFloat) -> BigFloat

Subtracts d2 from self and returns the result of the operation. The resulting precision is equal to the full precision of the result. This operation can be used to emulate integer subtraction.

source

pub fn mul(&self, d2: &BigFloat, p: usize, rm: RoundingMode) -> BigFloat

Multiplies d2 by self and returns the result of the operation with precision p rounded according to rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn mul_full_prec(&self, d2: &BigFloat) -> BigFloat

Multiplies d2 by self and returns the result of the operation. The resulting precision is equal to the full precision of the result. This operation can be used to emulate integer multiplication.

source

pub fn div(&self, d2: &BigFloat, p: usize, rm: RoundingMode) -> BigFloat

Divides self by d2 and returns the result of the operation with precision p rounded according to rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn rem(&self, d2: &BigFloat) -> BigFloat

Returns the remainder of division of |self| by |d2|. The sign of the result is set to the sign of self.

source

pub fn cmp(&self, d2: &BigFloat) -> Option<i128>

Compares self to d2. Returns positive if self > d2, negative if self < d2, zero if self == d2, None if self or d2 is NaN.

source

pub fn abs_cmp(&self, d2: &BigFloat) -> Option<i128>

Compares the absolute value of self to the absolute value of d2. Returns positive if |self| is greater than |d2|, negative if |self| is smaller than |d2|, 0 if |self| equals to |d2|, None if self or d2 is NaN.

source

pub fn inv_sign(&mut self)

Reverses the sign of self.

source

pub fn pow( &self, n: &BigFloat, p: usize, rm: RoundingMode, cc: &mut Consts ) -> BigFloat

Compute the power of self to the n with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn powi(&self, n: usize, p: usize, rm: RoundingMode) -> BigFloat

Compute the power of self to the integer n with precision p. The result is rounded using the rounding mode rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn log( &self, n: &BigFloat, p: usize, rm: RoundingMode, cc: &mut Consts ) -> BigFloat

Computes the logarithm base n of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn is_positive(&self) -> bool

Returns true if self is positive. The function returns false if self is NaN.

source

pub fn is_negative(&self) -> bool

Returns true if self is negative. The function returns false if self is NaN.

source

pub fn is_subnormal(&self) -> bool

Returns true if self is subnormal. A number is subnormal if the most significant bit of the mantissa is not equal to 1.

source

pub fn is_zero(&self) -> bool

Returns true if self is zero.

source

pub fn clamp(&self, min: &BigFloat, max: &BigFloat) -> BigFloat

Restricts the value of self to an interval determined by the values of min and max. The function returns max if self is greater than max, min if self is less than min, and self otherwise. If either argument is NaN or min is greater than max, the function returns NaN.

source

pub fn max(&self, d1: &BigFloat) -> BigFloat

Returns the value of d1 if d1 is greater than self, or the value of self otherwise. If either argument is NaN, the function returns NaN.

source

pub fn min(&self, d1: &BigFloat) -> BigFloat

Returns value of d1 if d1 is less than self, or the value of self otherwise. If either argument is NaN, the function returns NaN.

source

pub fn signum(&self) -> BigFloat

Returns a BigFloat with the value -1 if self is negative, 1 if self is positive, zero otherwise. The function returns NaN If self is NaN.

source

pub fn parse( s: &str, rdx: Radix, p: usize, rm: RoundingMode, cc: &mut Consts ) -> BigFloat

Parses a number from the string s. The function expects s to be a number in scientific format in radix rdx, or +-Inf, or NaN. if p equals to usize::MAX then the precision of the resulting number is determined automatically from the input.

§Examples
let mut cc = Consts::new().expect("Constants cache initialized.");

let n = BigFloat::parse("0.0", Radix::Bin, 64, RoundingMode::ToEven, &mut cc);
assert!(n.is_zero());

let n = BigFloat::parse("1.124e-24", Radix::Dec, 128, RoundingMode::ToEven, &mut cc);
assert!(n.sub(&BigFloat::from_f64(1.124e-24, 128), 128, RoundingMode::ToEven).exponent() <= Some(-52 - 24));

let n = BigFloat::parse("-Inf", Radix::Hex, 1, RoundingMode::None, &mut cc);
assert!(n.is_inf_neg());

let n = BigFloat::parse("NaN", Radix::Oct, 2, RoundingMode::None, &mut cc);
assert!(n.is_nan());
source

pub fn format( &self, rdx: Radix, rm: RoundingMode, cc: &mut Consts ) -> Result<String, Error>

Formats the number using radix rdx and rounding mode rm. Note, since hexadecimal digits include the character “e”, the exponent part is separated from the mantissa by “_”. For example, a number with mantissa 123abcdef and exponent 123 would be formatted as 123abcdef_e+123.

§Errors
  • MemoryAllocation: failed to allocate memory for mantissa.
  • ExponentOverflow: the resulting exponent becomes greater than the maximum allowed value for the exponent.
source

pub fn random_normal(p: usize, exp_from: i32, exp_to: i32) -> BigFloat

Returns a random normalized (not subnormal) BigFloat number with exponent in the range from exp_from to exp_to inclusive. The sign can be positive and negative. Zero is excluded. Precision is rounded upwards to the word size. Function does not follow any specific distribution law. The intended use of this function is for testing. The function returns NaN if the precision p is incorrect or when exp_from is less than EXPONENT_MIN or exp_to is greater than EXPONENT_MAX.

source

pub fn classify(&self) -> FpCategory

Returns category of self.

source

pub fn atan(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the arctangent of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn tanh(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the hyperbolic tangent of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

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

Returns the exponent of self, or None if self is Inf or NaN.

source

pub fn precision(&self) -> Option<usize>

Returns the number of significant bits used in the mantissa, or None if self is Inf or NaN. Normal numbers use all bits of the mantissa. Subnormal numbers use fewer bits than the mantissa can hold.

source

pub fn max_value(p: usize) -> BigFloat

Returns the maximum value for the specified precision p: all bits of the mantissa are set to 1, the exponent has the maximum possible value, and the sign is positive. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn min_value(p: usize) -> BigFloat

Returns the minimum value for the specified precision p: all bits of the mantissa are set to 1, the exponent has the maximum possible value, and the sign is negative. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn min_positive(p: usize) -> BigFloat

Returns the minimum positive subnormal value for the specified precision p: only the least significant bit of the mantissa is set to 1, the exponent has the minimum possible value, and the sign is positive. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn min_positive_normal(p: usize) -> BigFloat

Returns the minimum positive normal value for the specified precision p: only the most significant bit of the mantissa is set to 1, the exponent has the minimum possible value, and the sign is positive. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn from_word(d: u64, p: usize) -> BigFloat

Returns a new number with value d and the precision p. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn neg(&self) -> BigFloat

Returns a copy of the number with the sign reversed.

source

pub fn as_raw_parts(&self) -> Option<(&[u64], usize, Sign, i32, bool)>

Decomposes self into raw parts. The function returns a reference to a slice of words representing mantissa, numbers of significant bits in the mantissa, sign, exponent, and a bool value which specify whether the number is inexact.

source

pub fn from_raw_parts( m: &[u64], n: usize, s: Sign, e: i32, inexact: bool ) -> BigFloat

Constructs a number from the raw parts:

  • m is the mantisaa.
  • n is the number of significant bits in mantissa.
  • s is the sign.
  • e is the exponent.
  • inexact specify whether number is inexact.

This function returns NaN in the following situations:

  • n is larger than the number of bits in m.
  • n is smaller than the number of bits in m, but m does not represent corresponding subnormal number mantissa.
  • n is smaller than the number of bits in m, but e is not the minimum possible exponent.
  • n or the size of m is too large (larger than isize::MAX / 2 + EXPONENT_MIN).
  • e is less than EXPONENT_MIN or greater than EXPONENT_MAX.
source

pub fn from_words(m: &[u64], s: Sign, e: i32) -> BigFloat

Constructs a number from the slice of words:

  • m is the mantissa.
  • s is the sign.
  • e is the exponent.

The function returns NaN if e is less than EXPONENT_MIN or greater than EXPONENT_MAX.

source

pub fn sign(&self) -> Option<Sign>

Returns the sign of self, or None if self is NaN.

source

pub fn set_exponent(&mut self, e: i32)

Sets the exponent of self. Note that if self is subnormal, the exponent may not change, but the mantissa will shift instead. e will be clamped to the range from EXPONENT_MIN to EXPONENT_MAX if it’s outside of the range. See example below.

§Examples
// construct a subnormal value.
let mut n = BigFloat::min_positive(128);

assert_eq!(n.exponent(), Some(EXPONENT_MIN));
assert_eq!(n.precision(), Some(1));

// increase exponent.
let n_exp = n.exponent().expect("n is not NaN");
n.set_exponent(n_exp + 1);

// the outcome for subnormal number.
assert_eq!(n.exponent(), Some(EXPONENT_MIN));
assert_eq!(n.precision(), Some(2));
source

pub fn mantissa_max_bit_len(&self) -> Option<usize>

Returns the maximum mantissa length of self in bits regardless of whether self is normal or subnormal.

source

pub fn set_precision(&mut self, p: usize, rm: RoundingMode) -> Result<(), Error>

Sets the precision of self to p. If the new precision is smaller than the existing one, the number is rounded using specified rounding mode rm.

§Errors
  • MemoryAllocation: failed to allocate memory for mantissa.
  • InvalidArgument: the precision is incorrect.
source

pub fn reciprocal(&self, p: usize, rm: RoundingMode) -> BigFloat

Computes the reciprocal of a number with precision p. The result is rounded using the rounding mode rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn set_sign(&mut self, s: Sign)

Sets the sign of self.

source

pub fn mantissa_digits(&self) -> Option<&[u64]>

Returns the raw mantissa words of a number.

source

pub fn convert_from_radix( sign: Sign, digits: &[u8], e: i32, rdx: Radix, p: usize, rm: RoundingMode, cc: &mut Consts ) -> BigFloat

Converts an array of digits in radix rdx to BigFloat with precision p. digits represents mantissa and is interpreted as a number smaller than 1 and greater or equal to 1/rdx. The first element in digits is the most significant digit. e is the exponent part of the number, such that the number can be represented as digits * rdx ^ e. Precision is rounded upwards to the word size. if p equals usize::MAX then the precision of the resulting number is determined automatically from the input.

§Examples

Code below converts -0.1234567₈ × 10₈^3₈ given in radix 8 to BigFloat.

let mut cc = Consts::new().expect("Constants cache initialized.");

let g = BigFloat::convert_from_radix(
    Sign::Neg,
    &[1, 2, 3, 4, 5, 6, 7, 0],
    3,
    Radix::Oct,
    64,
    RoundingMode::None,
    &mut cc);

let n = BigFloat::from_f64(-83.591552734375, 64);

assert_eq!(n.cmp(&g), Some(0));
§Errors

On error, the function returns NaN with the following associated error:

  • MemoryAllocation: failed to allocate memory for mantissa.
  • ExponentOverflow: the resulting exponent becomes greater than the maximum allowed value for the exponent.
  • InvalidArgument: the precision is incorrect, or digits contains unacceptable digits for given radix, or when e is less than EXPONENT_MIN or greater than EXPONENT_MAX.
source

pub fn convert_to_radix( &self, rdx: Radix, rm: RoundingMode, cc: &mut Consts ) -> Result<(Sign, Vec<u8>, i32), Error>

Converts self to radix rdx using rounding mode rm. The function returns sign, mantissa digits in radix rdx, and exponent such that the converted number can be represented as mantissa digits * rdx ^ exponent. The first element in the mantissa is the most significant digit.

§Examples
let n = BigFloat::from_f64(0.00012345678f64, 64);

let mut cc = Consts::new().expect("Constants cache initialized.");

let (s, m, e) = n.convert_to_radix(Radix::Dec, RoundingMode::None, &mut cc).expect("Conversion failed");

assert_eq!(s, Sign::Pos);
assert_eq!(m, [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 4]);
assert_eq!(e, -3);
§Errors
  • MemoryAllocation: failed to allocate memory for mantissa.
  • ExponentOverflow: the resulting exponent becomes greater than the maximum allowed value for the exponent.
  • InvalidArgument: self is Inf or NaN.
source

pub fn inexact(&self) -> bool

Returns true if self is inexact. The function returns false if self is Inf or NaN.

source

pub fn set_inexact(&mut self, inexact: bool)

Marks self as inexact if inexact is true, or exact otherwise. The function has no effect if self is Inf or NaN.

source

pub fn try_set_precision( &mut self, p: usize, rm: RoundingMode, s: usize ) -> bool

Try to round and then set the precision to p, given self has s correct digits in mantissa. The function returns true if rounding succeeded, or if self is Inf or NaN. If the fuction returns false, self is still modified, and should be discarded. In case of an error, self will be set to NaN with an associated error. If the precision p is incorrect self will be set to NaN.

source§

impl BigFloat

source

pub fn abs(&self) -> BigFloat

Returns the absolute value of self.

source

pub fn int(&self) -> BigFloat

Returns the integer part of self.

source

pub fn fract(&self) -> BigFloat

Returns the fractional part of self.

source

pub fn ceil(&self) -> BigFloat

Returns the smallest integer greater than or equal to self.

source

pub fn floor(&self) -> BigFloat

Returns the largest integer less than or equal to self.

source

pub fn round(&self, n: usize, rm: RoundingMode) -> BigFloat

Returns the rounded number with n binary positions in the fractional part of the number using rounding mode rm.

source

pub fn sqrt(&self, p: usize, rm: RoundingMode) -> BigFloat

Computes the square root of a number with precision p. The result is rounded using the rounding mode rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn cbrt(&self, p: usize, rm: RoundingMode) -> BigFloat

Computes the cube root of a number with precision p. The result is rounded using the rounding mode rm. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn ln(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the natural logarithm of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn log2(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the logarithm base 2 of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn log10(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the logarithm base 10 of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn exp(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes e to the power of self with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn sin(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the sine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn cos(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the cosine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn tan(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the tangent of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn asin(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the arcsine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn acos(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the arccosine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn sinh(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the hyperbolic sine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn cosh(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the hyperbolic cosine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn asinh(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the hyperbolic arcsine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn acosh(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the hyperbolic arccosine of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source

pub fn atanh(&self, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Computes the hyperbolic arctangent of a number with precision p. The result is rounded using the rounding mode rm. This function requires constants cache cc for computing the result. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_i8(i: i8, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_i16(i: i16, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_i32(i: i32, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_i64(i: i64, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_i128(i: i128, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_u8(i: u8, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_u16(i: u16, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_u32(i: u32, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_u64(i: u64, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

source§

impl BigFloat

source

pub fn from_u128(i: u128, p: usize) -> BigFloat

Constructs BigFloat with precision p from an integer value i. Precision is rounded upwards to the word size. The function returns NaN if the precision p is incorrect.

Trait Implementations§

source§

impl Binary for BigFloat

source§

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

Formats the number. The implementation is not available in no_std environment.

source§

impl Clone for BigFloat

source§

fn clone(&self) -> BigFloat

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 BigFloat

source§

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

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

impl Default for BigFloat

source§

fn default() -> BigFloat

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

impl<'de> Deserialize<'de> for BigFloat

source§

fn deserialize<D>( deserializer: D ) -> Result<BigFloat, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for BigFloat

source§

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

Formats the number. The implementation is not available in no_std environment.

source§

impl From<BigFloatNumber> for BigFloat

source§

fn from(x: BigFloatNumber) -> BigFloat

Converts to this type from the input type.
source§

impl From<f32> for BigFloat

source§

fn from(v: f32) -> BigFloat

Converts to this type from the input type.
source§

impl From<f64> for BigFloat

source§

fn from(v: f64) -> BigFloat

Converts to this type from the input type.
source§

impl From<i128> for BigFloat

source§

fn from(v: i128) -> BigFloat

Converts to this type from the input type.
source§

impl From<i16> for BigFloat

source§

fn from(v: i16) -> BigFloat

Converts to this type from the input type.
source§

impl From<i32> for BigFloat

source§

fn from(v: i32) -> BigFloat

Converts to this type from the input type.
source§

impl From<i64> for BigFloat

source§

fn from(v: i64) -> BigFloat

Converts to this type from the input type.
source§

impl From<i8> for BigFloat

source§

fn from(v: i8) -> BigFloat

Converts to this type from the input type.
source§

impl From<u128> for BigFloat

source§

fn from(v: u128) -> BigFloat

Converts to this type from the input type.
source§

impl From<u16> for BigFloat

source§

fn from(v: u16) -> BigFloat

Converts to this type from the input type.
source§

impl From<u32> for BigFloat

source§

fn from(v: u32) -> BigFloat

Converts to this type from the input type.
source§

impl From<u64> for BigFloat

source§

fn from(v: u64) -> BigFloat

Converts to this type from the input type.
source§

impl From<u8> for BigFloat

source§

fn from(v: u8) -> BigFloat

Converts to this type from the input type.
source§

impl FromExt<&str> for BigFloat

source§

fn from_ext(v: &str, p: usize, rm: RoundingMode, cc: &mut Consts) -> BigFloat

Converts v to BigFloat with precision p using rounding mode rm.
source§

impl<T> FromExt<T> for BigFloat
where BigFloat: From<T>,

source§

fn from_ext(v: T, p: usize, rm: RoundingMode, _cc: &mut Consts) -> BigFloat

Converts v to BigFloat with precision p using rounding mode rm.
source§

impl FromStr for BigFloat

source§

fn from_str(src: &str) -> Result<BigFloat, <BigFloat as FromStr>::Err>

Returns parsed number or NAN in case of error. The implementation is not available in no_std environment.

§

type Err = Error

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

impl Neg for &BigFloat

§

type Output = BigFloat

The resulting type after applying the - operator.
source§

fn neg(self) -> <&BigFloat as Neg>::Output

Performs the unary - operation. Read more
source§

impl Neg for BigFloat

§

type Output = BigFloat

The resulting type after applying the - operator.
source§

fn neg(self) -> <BigFloat as Neg>::Output

Performs the unary - operation. Read more
source§

impl Octal for BigFloat

source§

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

Formats the number. The implementation is not available in no_std environment.

source§

impl<'a> PartialEq<&'a BigFloat> for BigFloat

source§

fn eq(&self, other: &&'a BigFloat) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for BigFloat

source§

fn eq(&self, other: &BigFloat) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd<&'a BigFloat> for BigFloat

source§

fn partial_cmp(&self, other: &&'a BigFloat) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd for BigFloat

source§

fn partial_cmp(&self, other: &BigFloat) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl Serialize for BigFloat

source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl UpperHex for BigFloat

source§

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

Formats the number. The implementation is not available in no_std environment.

source§

impl Eq for BigFloat

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> ToOwned for T
where 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 T
where 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 T
where 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 T
where 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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,