Struct num_bigfloat::BigFloat

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

Number representation.

Implementations§

source§

impl BigFloat

source

pub fn new() -> Self

Returns a new BigFloat with the value of zero.

source

pub fn from_bytes(bytes: &[u8], sign: i8, exponent: i8) -> Self

Creates a BigFloat value from a sequence of bytes. Each byte must represent a decimal digit. First byte is the most significant. bytes can be of any length. If bytes is longer than required, then the remaining bytes are ignored. If the “sign” is negative, then the resulting BigFloat will be negative.

§Examples
let n1 = BigFloat::from_bytes(&[1,2,3,4,2,0,0,0], 1, -3);
let n2 = BigFloat::from_u32(12342);
assert!(n1.cmp(&n2) == Some(0));
source

pub fn from_f64(f: f64) -> Self

Creates a BigFloat from f64. The conversion is not guaranteed to be lossless since BigFloat and f64 have different bases.

source

pub fn from_f32(f: f32) -> Self

Creates a BigFloat from f32. The conversion is not guaranteed to be lossless since BigFloat and f64 have different bases.

source

pub fn to_f64(&self) -> f64

Converts BigFloat to f64.

source

pub fn to_f32(&self) -> f32

Converts BigFloat to f32.

source

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

Converts BigFloat to i64. The function retursn None if self is Inf, NaN, or out of range of i64.

source

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

Converts BigFloat to i128. The function retursn None if self is Inf, NaN, or out of range of i128.

source

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

Converts absolute value of self to u64. The function retursn None if self is Inf, NaN, or out of range of u64.

source

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

Converts absolute value of self to u128. The function retursn None if self is Inf, NaN, or out of range of u128.

source

pub fn get_mantissa_bytes(&self, bytes: &mut [u8])

Returns the mantissa of the BigFloat in bytes. Each byte represents a decimal digit. The first byte is the most significant. bytes can be of any length. If the length of bytes is less than the number of decimal positions filled in the mantissa, then the rest of the mantissa will be omitted.

The length of the mantissa can be determined using get_mantissa_len. If self is Inf or NaN, nothing is returned.

§Examples
let n = BigFloat::from_f64(123.42);
let mut m = [0; 40];
n.get_mantissa_bytes(&mut m);
// compare m[0..10] to [1,2,3,4,2,0,0,0,0,0]
assert!(m[0..10].iter().zip([1,2,3,4,2,0,0,0,0,0].iter()).filter(|x| { x.0 != x.1 }).count() == 0);
source

pub fn get_mantissa_len(&self) -> usize

Returns the number of decimal places filled in the mantissa. If self is Inf or NaN, 0 is returned.

source

pub fn get_sign(&self) -> i8

Returns 1 if BigFloat is positive, -1 otherwise. If self is NaN, 0 is returned.

source

pub fn get_exponent(&self) -> i8

Returns the exponent part of the number. If self is Inf or NaN, 0 is returned.

source

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

Sets the exponent part of the number. The function has no effect on Inf and NaN values.

source

pub fn to_raw_parts(&self) -> Option<([i16; 10], i16, i8, i8)>

Returns the raw parts of the number: the mantissa, the number of decimal places in the mantissa, the sign, and the exponent. If self is Inf or NaN, None is returned.

source

pub fn from_raw_parts( mantissa: [i16; 10], mantissa_len: i16, sign: i8, exponent: i8 ) -> Self

Creates a BigFloat from the raw parts. to_raw_parts can be used to get the raw parts of a number.

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 add(&self, d2: &Self) -> Self

Adds d2 to self and returns the result of the addition.

source

pub fn sub(&self, d2: &Self) -> Self

Subtracts d2 from self and return the result of the subtraction.

source

pub fn mul(&self, d2: &Self) -> Self

Multiplies self by d2 and returns the result of the multiplication.

source

pub fn div(&self, d2: &Self) -> Self

Divides self by d2 and returns the result of the division.

source

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

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 inv_sign(&self) -> BigFloat

Reverses the sign of a number.

source

pub fn pow(&self, d1: &Self) -> Self

Returns self to the power of d1.

source

pub fn log(&self, b: &Self) -> Self

Returns the logarithm base b of a number.

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 considered subnormal if not all digits of the mantissa are used, and the exponent has the minimum possible value.

source

pub fn is_zero(&self) -> bool

Returns true if self is zero.

source

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

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: &Self) -> Self

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: &Self) -> Self

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) -> Self

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) -> Option<Self>

Parses a number from the string s. The function expects s to be a number in scientific format in base 10, or +-Inf, or NaN.

§Examples
use num_bigfloat::BigFloat;

let n = BigFloat::parse("0.0").unwrap();
assert!(n.to_f64() == 0.0);
let n = BigFloat::parse("1.123e-123").unwrap();
assert!((n.to_f64() - 1.123e-123).abs() < f64::EPSILON);
let n = BigFloat::parse("-Inf").unwrap();
assert!(n.to_f64() == f64::NEG_INFINITY);
let n = BigFloat::parse("NaN").unwrap();
assert!(n.to_f64().is_nan());
source

pub fn random_normal(exp_from: i8, exp_to: i8) -> Result<Self, Error>

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. Function does not follow any specific distribution law. The intended use of this function is for testing.

§Errors

InvalidArgument - when exp_from is greater than exp_to.

source

pub fn classify(&self) -> FpCategory

Returns category of self as defined by core::num::FpCategory.

source

pub fn rem(&self, d1: &Self) -> Self

Returns the remainder of division of self by d1.

source§

impl BigFloat

source

pub fn abs(&self) -> Self

Returns the absolute value of self.

source

pub fn int(&self) -> Self

Returns the integer part of self.

source

pub fn frac(&self) -> Self

Returns the fractional part of self.

source

pub fn ceil(&self) -> Self

Returns the smallest integer greater than or equal to self.

source

pub fn floor(&self) -> Self

Returns the largest integer less than or equal to self.

source

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

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

source

pub fn sqrt(&self) -> Self

Returns the square root of self.

source

pub fn cbrt(&self) -> Self

Returns the cube root of self.

source

pub fn ln(&self) -> Self

Returns the natural logarithm of self.

source

pub fn log2(&self) -> Self

Returns the logarithm base 2 of self.

source

pub fn log10(&self) -> Self

Returns the logarithm base 10 of self.

source

pub fn exp(&self) -> Self

Returns e to the power of self.

source

pub fn sin(&self) -> Self

Returns the sine of self. The function takes an angle in radians as an argument.

source

pub fn cos(&self) -> Self

Returns the cosine of self. The function takes an angle in radians as an argument.

source

pub fn tan(&self) -> Self

Returns the tangent of self. The function takes an angle in radians as an argument.

source

pub fn asin(&self) -> Self

Returns the arcsine of self. The result is an angle in radians ranging from -pi/2 to pi/2.

source

pub fn acos(&self) -> Self

Returns the arccosine of self. The result is an angle in radians ranging from 0 to pi.

source

pub fn atan(&self) -> Self

Returns the arctangent of self. The result is an angle in radians ranging from -pi/2 to pi/2.

source

pub fn sinh(&self) -> Self

Returns the hyperbolic sine of self.

source

pub fn cosh(&self) -> Self

Returns the hyperbolic cosine of self.

source

pub fn tanh(&self) -> Self

Returns the hyperbolic tangent of self.

source

pub fn asinh(&self) -> Self

Returns the inverse hyperbolic sine of self.

source

pub fn acosh(&self) -> Self

Returns the inverse hyperbolic cosine of self.

source

pub fn atanh(&self) -> Self

Returns the inverse hyperbolic tangent of self.

source§

impl BigFloat

source

pub fn from_i8(i: i8) -> Self

Construct BigFloat from integer value.

source

pub fn from_u8(i: u8) -> Self

Construct BigFloat from integer value.

source§

impl BigFloat

source

pub fn from_i16(i: i16) -> Self

Construct BigFloat from integer value.

source

pub fn from_u16(i: u16) -> Self

Construct BigFloat from integer value.

source§

impl BigFloat

source

pub fn from_i32(i: i32) -> Self

Construct BigFloat from integer value.

source

pub fn from_u32(i: u32) -> Self

Construct BigFloat from integer value.

source§

impl BigFloat

source

pub fn from_i64(i: i64) -> Self

Construct BigFloat from integer value.

source

pub fn from_u64(i: u64) -> Self

Construct BigFloat from integer value.

source§

impl BigFloat

source

pub fn from_i128(i: i128) -> Self

Construct BigFloat from integer value.

source

pub fn from_u128(i: u128) -> Self

Construct BigFloat from integer value.

Trait Implementations§

source§

impl Add<&BigFloat> for BigFloat

§

type Output = BigFloat

The resulting type after applying the + operator.
source§

fn add(self, rhs: &BigFloat) -> Self::Output

Performs the + operation. Read more
source§

impl Add for BigFloat

§

type Output = BigFloat

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<&BigFloat> for BigFloat

source§

fn add_assign(&mut self, rhs: &BigFloat)

Performs the += operation. Read more
source§

impl AddAssign for BigFloat

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl Bounded for BigFloat

source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
source§

fn max_value() -> Self

Returns the largest finite number this type can represent
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

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<Self, __D::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 value using the given formatter. Read more
source§

impl Div<&BigFloat> for BigFloat

§

type Output = BigFloat

The resulting type after applying the / operator.
source§

fn div(self, rhs: &BigFloat) -> Self::Output

Performs the / operation. Read more
source§

impl Div for BigFloat

§

type Output = BigFloat

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<&BigFloat> for BigFloat

source§

fn div_assign(&mut self, rhs: &BigFloat)

Performs the /= operation. Read more
source§

impl DivAssign for BigFloat

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl Euclid for BigFloat

source§

fn div_euclid(&self, v: &BigFloat) -> BigFloat

Calculates Euclidean division, the matching method for rem_euclid. Read more
source§

fn rem_euclid(&self, v: &BigFloat) -> BigFloat

Calculates the least nonnegative remainder of self (mod v). Read more
source§

fn div_rem_euclid(&self, v: &Self) -> (Self, Self)

Returns both the quotient and remainder from Euclidean division. Read more
source§

impl Float for BigFloat

source§

fn neg_zero() -> Self

This function is provided only for compatibility since -0.0 is not implemented.

source§

fn is_sign_positive(self) -> bool

Note: BigFloat NaN has no sign.

source§

fn is_sign_negative(self) -> bool

Note: BigFloat NaN has no sign.

source§

fn mul_add(self, a: Self, b: Self) -> Self

This function is provided only for compatibility. It is not faster than separate multiplication and addition.

source§

fn powi(self, n: i32) -> Self

This function is provided only for compatibility. It is not faster than powf.

source§

fn sin_cos(self) -> (Self, Self)

This function is provided only for compatibility.

source§

fn exp_m1(self) -> Self

This function is provided only for compatibility.

source§

fn ln_1p(self) -> Self

This function is provided only for compatibility.

source§

fn integer_decode(self) -> (u64, i16, i8)

This function converts BigFloat to f64 and decomposes it.

source§

fn nan() -> Self

Returns the NaN value. Read more
source§

fn infinity() -> Self

Returns the infinite value. Read more
source§

fn neg_infinity() -> Self

Returns the negative infinite value. Read more
source§

fn min_value() -> Self

Returns the smallest finite value that this type can represent. Read more
source§

fn min_positive_value() -> Self

Returns the smallest positive, normalized value that this type can represent. Read more
source§

fn max_value() -> Self

Returns the largest finite value that this type can represent. Read more
source§

fn is_nan(self) -> bool

Returns true if this value is NaN and false otherwise. Read more
source§

fn is_infinite(self) -> bool

Returns true if this value is positive infinity or negative infinity and false otherwise. Read more
source§

fn is_finite(self) -> bool

Returns true if this number is neither infinite nor NaN. Read more
source§

fn is_normal(self) -> bool

Returns true if the number is neither zero, infinite, subnormal, or NaN. Read more
source§

fn classify(self) -> FpCategory

Returns the floating point category of the number. If only one property is going to be tested, it is generally faster to use the specific predicate instead. Read more
source§

fn floor(self) -> Self

Returns the largest integer less than or equal to a number. Read more
source§

fn ceil(self) -> Self

Returns the smallest integer greater than or equal to a number. Read more
source§

fn round(self) -> Self

Returns the nearest integer to a number. Round half-way cases away from 0.0. Read more
source§

fn trunc(self) -> Self

Return the integer part of a number. Read more
source§

fn fract(self) -> Self

Returns the fractional part of a number. Read more
source§

fn abs(self) -> Self

Computes the absolute value of self. Returns Float::nan() if the number is Float::nan(). Read more
source§

fn signum(self) -> Self

Returns a number that represents the sign of self. Read more
source§

fn recip(self) -> Self

Take the reciprocal (inverse) of a number, 1/x. Read more
source§

fn powf(self, n: Self) -> Self

Raise a number to a floating point power. Read more
source§

fn sqrt(self) -> Self

Take the square root of a number. Read more
source§

fn exp(self) -> Self

Returns e^(self), (the exponential function). Read more
source§

fn exp2(self) -> Self

Returns 2^(self). Read more
source§

fn ln(self) -> Self

Returns the natural logarithm of the number. Read more
source§

fn log(self, base: Self) -> Self

Returns the logarithm of the number with respect to an arbitrary base. Read more
source§

fn log2(self) -> Self

Returns the base 2 logarithm of the number. Read more
source§

fn log10(self) -> Self

Returns the base 10 logarithm of the number. Read more
source§

fn max(self, other: Self) -> Self

Returns the maximum of the two numbers. Read more
source§

fn min(self, other: Self) -> Self

Returns the minimum of the two numbers. Read more
source§

fn abs_sub(self, other: Self) -> Self

The positive difference of two numbers. Read more
source§

fn cbrt(self) -> Self

Take the cubic root of a number. Read more
source§

fn hypot(self, other: Self) -> Self

Calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y. Read more
source§

fn sin(self) -> Self

Computes the sine of a number (in radians). Read more
source§

fn cos(self) -> Self

Computes the cosine of a number (in radians). Read more
source§

fn tan(self) -> Self

Computes the tangent of a number (in radians). Read more
source§

fn asin(self) -> Self

Computes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1]. Read more
source§

fn acos(self) -> Self

Computes the arccosine of a number. Return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1]. Read more
source§

fn atan(self) -> Self

Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2]; Read more
source§

fn atan2(self, other: Self) -> Self

Computes the four quadrant arctangent of self (y) and other (x). Read more
source§

fn sinh(self) -> Self

Hyperbolic sine function. Read more
source§

fn cosh(self) -> Self

Hyperbolic cosine function. Read more
source§

fn tanh(self) -> Self

Hyperbolic tangent function. Read more
source§

fn asinh(self) -> Self

Inverse hyperbolic sine function. Read more
source§

fn acosh(self) -> Self

Inverse hyperbolic cosine function. Read more
source§

fn atanh(self) -> Self

Inverse hyperbolic tangent function. Read more
source§

fn epsilon() -> Self

Returns epsilon, a small positive value. Read more
source§

fn is_subnormal(self) -> bool

Returns true if the number is subnormal. Read more
source§

fn to_degrees(self) -> Self

Converts radians to degrees. Read more
source§

fn to_radians(self) -> Self

Converts degrees to radians. Read more
source§

fn copysign(self, sign: Self) -> Self

Returns a number composed of the magnitude of self and the sign of sign. Read more
source§

impl FloatConst for BigFloat

source§

fn E() -> Self

Return Euler’s number.
source§

fn FRAC_1_PI() -> Self

Return 1.0 / π.
source§

fn FRAC_1_SQRT_2() -> Self

Return 1.0 / sqrt(2.0).
source§

fn FRAC_2_PI() -> Self

Return 2.0 / π.
source§

fn FRAC_2_SQRT_PI() -> Self

Return 2.0 / sqrt(π).
source§

fn FRAC_PI_2() -> Self

Return π / 2.0.
source§

fn FRAC_PI_3() -> Self

Return π / 3.0.
source§

fn FRAC_PI_4() -> Self

Return π / 4.0.
source§

fn FRAC_PI_6() -> Self

Return π / 6.0.
source§

fn FRAC_PI_8() -> Self

Return π / 8.0.
source§

fn LN_10() -> Self

Return ln(10.0).
source§

fn LN_2() -> Self

Return ln(2.0).
source§

fn LOG10_E() -> Self

Return log10(e).
source§

fn LOG2_E() -> Self

Return log2(e).
source§

fn PI() -> Self

Return Archimedes’ constant π.
source§

fn SQRT_2() -> Self

Return sqrt(2.0).
source§

fn TAU() -> Self
where Self: Sized + Add<Output = Self>,

Return the full circle constant τ.
source§

fn LOG10_2() -> Self
where Self: Sized + Div<Output = Self>,

Return log10(2.0).
source§

fn LOG2_10() -> Self
where Self: Sized + Div<Output = Self>,

Return log2(10.0).
source§

impl From<f32> for BigFloat

source§

fn from(f: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for BigFloat

source§

fn from(f: f64) -> Self

Converts to this type from the input type.
source§

impl From<i128> for BigFloat

source§

fn from(i: i128) -> Self

Converts to this type from the input type.
source§

impl From<i16> for BigFloat

source§

fn from(i: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for BigFloat

source§

fn from(i: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for BigFloat

source§

fn from(i: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for BigFloat

source§

fn from(i: i8) -> Self

Converts to this type from the input type.
source§

impl From<u128> for BigFloat

source§

fn from(i: u128) -> Self

Converts to this type from the input type.
source§

impl From<u16> for BigFloat

source§

fn from(i: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for BigFloat

source§

fn from(i: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for BigFloat

source§

fn from(i: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for BigFloat

source§

fn from(i: u8) -> Self

Converts to this type from the input type.
source§

impl FromPrimitive for BigFloat

source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i128(n: i128) -> Option<Self>

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_u128(n: u128) -> Option<Self>

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

impl FromStr for BigFloat

source§

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

Returns parsed number or NAN in case of error.

§

type Err = BigFloat

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

impl Inv for BigFloat

§

type Output = BigFloat

The result after applying the operator.
source§

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
source§

impl Mul<&BigFloat> for BigFloat

§

type Output = BigFloat

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &BigFloat) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for BigFloat

§

type Output = BigFloat

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl MulAdd for BigFloat

This trait is provided only for compatibility. It does not provide performance benefits.

§

type Output = BigFloat

The resulting type after applying the fused multiply-add.
source§

fn mul_add(self, a: Self, b: Self) -> Self::Output

Performs the fused multiply-add operation (self * a) + b
source§

impl MulAddAssign for BigFloat

This trait is provided only for compatibility. It does not provide performance benefits.

source§

fn mul_add_assign(&mut self, a: Self, b: Self)

Performs the fused multiply-add assignment operation *self = (*self * a) + b
source§

impl MulAssign<&BigFloat> for BigFloat

source§

fn mul_assign(&mut self, rhs: &BigFloat)

Performs the *= operation. Read more
source§

impl MulAssign for BigFloat

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl Neg for &BigFloat

§

type Output = BigFloat

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::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) -> Self::Output

Performs the unary - operation. Read more
source§

impl Num for BigFloat

§

type FromStrRadixErr = Error

source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
source§

impl NumCast for BigFloat

source§

fn from<T: ToPrimitive>(n: T) -> Option<BigFloat>

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. If the source value cannot be represented by the target type, then None is returned. Read more
source§

impl One for BigFloat

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
source§

impl PartialEq for BigFloat

source§

fn eq(&self, other: &Self) -> 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 PartialOrd for BigFloat

source§

fn partial_cmp(&self, other: &Self) -> 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 Pow<BigFloat> for BigFloat

§

type Output = BigFloat

The result after applying the operator.
source§

fn pow(self, rhs: BigFloat) -> Self::Output

Returns self to the power rhs. Read more
source§

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

source§

fn product<I: Iterator<Item = &'a BigFloat>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Product for BigFloat

source§

fn product<I: Iterator<Item = BigFloat>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Rem for BigFloat

§

type Output = BigFloat

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
source§

impl Serialize for BigFloat

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

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

impl Signed for BigFloat

source§

fn abs(&self) -> Self

Note: BigFloat NaN has no sign.

source§

fn signum(&self) -> Self

Note: BigFloat NaN has no sign.

source§

fn abs_sub(&self, other: &Self) -> Self

The positive difference of two numbers. Read more
source§

fn is_positive(&self) -> bool

Returns true if the number is positive and false if the number is zero or negative.
source§

fn is_negative(&self) -> bool

Returns true if the number is negative and false if the number is zero or positive.
source§

impl Sub<&BigFloat> for BigFloat

§

type Output = BigFloat

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &BigFloat) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for BigFloat

§

type Output = BigFloat

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<&BigFloat> for BigFloat

source§

fn sub_assign(&mut self, rhs: &BigFloat)

Performs the -= operation. Read more
source§

impl SubAssign for BigFloat

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

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

source§

fn sum<I: Iterator<Item = &'a BigFloat>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Sum for BigFloat

source§

fn sum<I: Iterator<Item = BigFloat>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl ToPrimitive for BigFloat

source§

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

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
source§

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

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
source§

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

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
source§

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

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
source§

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

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
source§

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

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
source§

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

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
source§

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

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
source§

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

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
source§

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

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
source§

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

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
source§

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

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
source§

impl Zero for BigFloat

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl Copy for BigFloat

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> LowerBounded for T
where T: Bounded,

source§

fn min_value() -> T

Returns the smallest finite number this type can represent
source§

impl<T> Real for T
where T: Float,

source§

fn min_value() -> T

Returns the smallest finite value that this type can represent. Read more
source§

fn min_positive_value() -> T

Returns the smallest positive, normalized value that this type can represent. Read more
source§

fn epsilon() -> T

Returns epsilon, a small positive value. Read more
source§

fn max_value() -> T

Returns the largest finite value that this type can represent. Read more
source§

fn floor(self) -> T

Returns the largest integer less than or equal to a number. Read more
source§

fn ceil(self) -> T

Returns the smallest integer greater than or equal to a number. Read more
source§

fn round(self) -> T

Returns the nearest integer to a number. Round half-way cases away from 0.0. Read more
source§

fn trunc(self) -> T

Return the integer part of a number. Read more
source§

fn fract(self) -> T

Returns the fractional part of a number. Read more
source§

fn abs(self) -> T

Computes the absolute value of self. Returns Float::nan() if the number is Float::nan(). Read more
source§

fn signum(self) -> T

Returns a number that represents the sign of self. Read more
source§

fn is_sign_positive(self) -> bool

Returns true if self is positive, including +0.0, Float::infinity(), and with newer versions of Rust f64::NAN. Read more
source§

fn is_sign_negative(self) -> bool

Returns true if self is negative, including -0.0, Float::neg_infinity(), and with newer versions of Rust -f64::NAN. Read more
source§

fn mul_add(self, a: T, b: T) -> T

Fused multiply-add. Computes (self * a) + b with only one rounding error, yielding a more accurate result than an unfused multiply-add. Read more
source§

fn recip(self) -> T

Take the reciprocal (inverse) of a number, 1/x. Read more
source§

fn powi(self, n: i32) -> T

Raise a number to an integer power. Read more
source§

fn powf(self, n: T) -> T

Raise a number to a real number power. Read more
source§

fn sqrt(self) -> T

Take the square root of a number. Read more
source§

fn exp(self) -> T

Returns e^(self), (the exponential function). Read more
source§

fn exp2(self) -> T

Returns 2^(self). Read more
source§

fn ln(self) -> T

Returns the natural logarithm of the number. Read more
source§

fn log(self, base: T) -> T

Returns the logarithm of the number with respect to an arbitrary base. Read more
source§

fn log2(self) -> T

Returns the base 2 logarithm of the number. Read more
source§

fn log10(self) -> T

Returns the base 10 logarithm of the number. Read more
source§

fn to_degrees(self) -> T

Converts radians to degrees. Read more
source§

fn to_radians(self) -> T

Converts degrees to radians. Read more
source§

fn max(self, other: T) -> T

Returns the maximum of the two numbers. Read more
source§

fn min(self, other: T) -> T

Returns the minimum of the two numbers. Read more
source§

fn abs_sub(self, other: T) -> T

The positive difference of two numbers. Read more
source§

fn cbrt(self) -> T

Take the cubic root of a number. Read more
source§

fn hypot(self, other: T) -> T

Calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y. Read more
source§

fn sin(self) -> T

Computes the sine of a number (in radians). Read more
source§

fn cos(self) -> T

Computes the cosine of a number (in radians). Read more
source§

fn tan(self) -> T

Computes the tangent of a number (in radians). Read more
source§

fn asin(self) -> T

Computes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1]. Read more
source§

fn acos(self) -> T

Computes the arccosine of a number. Return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1]. Read more
source§

fn atan(self) -> T

Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2]; Read more
source§

fn atan2(self, other: T) -> T

Computes the four quadrant arctangent of self (y) and other (x). Read more
source§

fn sin_cos(self) -> (T, T)

Simultaneously computes the sine and cosine of the number, x. Returns (sin(x), cos(x)). Read more
source§

fn exp_m1(self) -> T

Returns e^(self) - 1 in a way that is accurate even if the number is close to zero. Read more
source§

fn ln_1p(self) -> T

Returns ln(1+n) (natural logarithm) more accurately than if the operations were performed separately. Read more
source§

fn sinh(self) -> T

Hyperbolic sine function. Read more
source§

fn cosh(self) -> T

Hyperbolic cosine function. Read more
source§

fn tanh(self) -> T

Hyperbolic tangent function. Read more
source§

fn asinh(self) -> T

Inverse hyperbolic sine function. Read more
source§

fn acosh(self) -> T

Inverse hyperbolic cosine function. Read more
source§

fn atanh(self) -> T

Inverse hyperbolic tangent function. Read more
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<T> UpperBounded for T
where T: Bounded,

source§

fn max_value() -> T

Returns the largest finite number this type can represent
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>,

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,