Struct arpfloat::Float

source ·
pub struct Float<const EXPONENT: usize, const MANTISSA: usize> { /* private fields */ }
Expand description

This is the main data structure of this library. It represents an arbitrary-precision floating-point number. The data structure is generic and accepts the EXPONENT and MANTISSA constants, that represent the encoding number of bits that are dedicated to storing these values.

Implementations§

Computes a+b using the rounding mode rm.

Computes a-b using the rounding mode rm.

Compute a*b using the rounding mode rm.

Compute a/b, with the rounding mode rm.

Load the integer val into the float. Notice that the number may overflow, or rounded to the nearest even integer.

Load the integer val into the float. Notice that the number may overflow, or rounded to the nearest even integer.

Converts and returns the rounded integral part.

Returns a value that is rounded to the nearest integer that’s not larger in magnitude than this float.

Cast to another float using the rounding mode rm.

Convert from one float format to another.

Create a new normal floating point number.

Create a new normal floating point number.

Returns a new zero float.

Returns a new infinity float.

Returns a new NaN float.

Returns true if the Float is negative

Returns true if the Float is +-inf.

Returns true if the Float is a +- NaN.

Returns true if the Float is a +- NaN.

Returns true if this number is normal (not Zero, Nan, Inf).

Update the sign of the float to sign. True means negative.

Returns the sign of the float. True means negative.

Returns the mantissa of the float.

Returns the exponent of the float.

Returns the category of the float.

Returns a new float which has a flipped sign (negated value).

Prints the number using the internal representation.

Returns the upper and lower bounds of the exponent.

Trait Implementations§

The resulting type after applying the + operator.
Performs the + operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the / operator.
Performs the / operation. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Page 66. Chapter 3. Floating-Point Formats and Environment Table 3.8: Comparison predicates and the four relations. and IEEE 754-2019 section 5.10 - totalOrder.

This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
The resulting type after applying the - operator.
Performs the - operation. 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
Converts the given value to a String. 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.