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

Number representation.

Implementations

Return new BigFloat with value zero.

Return BigFloat with the value of 1.

Return new BigFloat with value two.

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.

Construct BigFloat from f64.

Errors

ExponentOverflow - when result is too big or too small.

Convert BigFloat to f64.

Construct BigFloat from f32. Wrapper for from_f64.

Errors

ExponentOverflow - when result is too big or too small.

Convert BigFloat to f32. Wrapper for to_f64

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.

Return the number of decimal positions filled in the mantissa.

Return 1 if BigFloat is positive, -1 otherwise.

Return exponent part.

Return absolute value.

Add d2 and return result of addition.

Errors

ExponentOverflow - when result is too big or too small.

Subtract d2 and return result of subtraction.

Errors

ExponentOverflow - when result is too big or too small.

Multiply by d2 and return result of multiplication.

Errors

ExponentOverflow - when result is too big or too small.

Divide by d2 and return result of division.

Errors

ExponentOverflow - when result is too big or too small. DivisionByZero - in case of d2 equal to zero.

Return square root of a number.

Errors

Returns ArgumentIsNegative if self is less than 0.

Return BigFloat to the power of d1.

Errors

ExponentOverflow - when result is too big or too small.

ArgumentIsNegative - when d1 has fractional part and self is negative.

Returns natural logarithm of a number.

Errors

ExponentOverflow - when result is too big or too small.

InvalidArgument - when self is negative or zero.

Returns sine of a number. Argument is an angle in radians.

Errors

ExponentOverflow - when result is too big or too small.

Returns cosine of a number. Argument is an angle in radians.

Errors

ExponentOverflow - when result is too big or too small.

Returns tangent of a number. Argument is an angle in radians.

Errors

ExponentOverflow - when result is too big or too small.

Returns arcsine of a number. Result is an angle in radians ranging from -pi to pi.

Errors

ExponentOverflow - when result is too big or too small. InvalidArgument - when |self| > 1.

Returns arccosine of a number.

Errors

ExponentOverflow - when result is too big or too small. InvalidArgument - when |self| > 1.

Returns arctangent of a number.

Errors

ExponentOverflow - when result is too big or too small.

Returns hyperbolic sine of a number.

Errors

ExponentOverflow - when result is too big or too small.

Returns hyperbolic cosine of a number.

Errors

ExponentOverflow - when result is too big or too small.

Returns hyperbolic tangent of a number.

Errors

ExponentOverflow - when result is too big or too small.

Returns inverse hyperbolic sine of a number.

Errors

ExponentOverflow - when result is too big or too small.

Returns inverse hyperbolic cosine of a number.

Errors

ExponentOverflow - when result is too big or too small. InvalidArgument - when self is less than 1.

Returns inverse hyperbolic tangent of a number.

Errors

ExponentOverflow - when result is too big or too small. InvalidArgument - when |self| >= 1.

Returns the largest integer less than or equal to a number.

Errors

ExponentOverflow - when result is too big or too small.

Returns the smallest integer greater than or equal to a number.

Errors

ExponentOverflow - when result is too big or too small.

Return fractional part of a number, i.e. having self=12.345 it will return 0.345.

Return integer part of a number, i.e. having self=12.345 it will return 12.0.

Returns the rounded number with n decimal positions in the fractional part of the number.

Compare to d2. Returns positive if self > d2, negative if self < d2, 0 otherwise.

Return raw parts of BigFloat: mantissa, number of decimal positions in mantissa, sing, and exponent.

Construct BigFloat from raw parts.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.