#[repr(transparent)]
pub struct Finite<F: IsFinite>(_);

Implementations

Attempts to create a new Finite float.

Errors

If the value is non-finite.

Gets the inner value of this number.

Creates a new checked float.

Panics

If the number is non-finite. Note that this fn will not panic in release mode, unless the strict feature flag is set.

Returns the larger of two floating point values.

Returns the smaller of two floating point values.

Rounds this floating point number to the previous whole number.

Rounds this floating point number to the next whole number.

Rounds this floating point number to the nearest whole number.

Drops the fractional part of this floating point number.

Returns the fractional part of this floating point number.

Computes the absolute value of self.

Returns a number that represents the sign of self.

  • 1.0 if the number is positive, +0.0 or INFINITY
  • -1.0 if the number is negative, -0.0 or NEG_INFINITY

Returns true if self has a negative sign, including -0.0 and negative infinity.

Returns true if self has a positive sign, including +0.0 and positive infinity.

Attempts to add two numbers.

Errors

If the result is non-finite.

Attempts to subtract two numbers.

Errors

If the result is non-finite.

Attempts to negate a number.

Errors

If the result is non-finite.

Attempts to multiply two numbers.

Errors

If the result is non-finite.

Attempts to divide two numbers.

Errors

If the result is non-finite.

Attempts to find the remainder of two numbers.

Errors

If the result is non-finite.

Attempts to raise self to the power n.

Errors

If the result is non-finite.

Attempts to raise self to the power n.

Errors

If the result is non-finite.

Raises self to the power n.

Panics

If the result is non-finite.

Raises self to the power n.

Panics

If the result is non-finite.

Attempts to compute the reciprocal (1/x) of self.

Errors

If the result is non-finite.

Computes the reciprocal (1/x) of self.

Panics

If the result is non-finite.

Attempts to find the square root of a number.

Errors

If the result is non-finite.

Computes the square root of a number.

Panics

If the result is non-finite.

Computes the cube root of a number.

Attempts to calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y.

Equivalent to sqrt(x^2 + y^2).

Errors

If the result is non-finite.

Calculates the length of the hypotenuse of a right-angle triangle given legs of length x and y.

Panics

If the result is non-finite.

Attempts to find e^(self), the exponential function.

Errors

If the result is non-finite.

Attempts to find 2^(self).

Errors

If the result is non-finite.

Attempts to find e^(self) - 1 in a way that is accurate even if the number is close to zero.

Errors

If the result is non-finite.

Computes e^(self), the exponential function.

Panics

If the result is non-finite.

Computes 2^(self).

Panics

If the result is non-finite.

Computes e^(self) - 1 more accurately than performing the operations separately.

Panics

If the result is non-finite.

Attempts to find the log base b of self.

Errors

If the result is non-finite.

Attempts to find the natural log (base e) of self.

Errors

If the result is non-finite.

Attempts to find the log base 2 of self.

Errors

If the result is non-finite.

Attempts to find the log base 10 of self.

Errors

If the result is non-finite.

Attempts to find ln(1+n) (natural logarithm) more accurately than if the operations were performed separately.

Errors

If the result is non-finite.

Computes the log base b of self.

Panics

If the result is non-finite.

Computes the natural log (base e) of self.

Panics

If the result is non-finite.

Computes the log base 2 of self.

Panics

If the result is non-finite.

Computes the log base 10 of self.

Panics

If the result is non-finite.

Computes ln(1+n) (natural logarithm) more accurately than if the operations were performed separately.

Panics

If the result is non-finite.

Computes the sine of a number.

Computes the cosine of a number.

Computes the sine and cosine of a number simultaneously.

Attempts to compute the tangent of a number (in radians).

Errors

If the result is non-finite.

Computes the tangent of a number.

Panics

If the result is non-finite.

Attempts to compute the arcsine of a number (in radians).

Errors

If the result is non-finite (caused if the magnitude of the input exceeds 1).

Attempts to compute the arccosine of a number (in radians).

Errors

If the result is non-finite (caused if the magnitude of the input exceeds 1).

Computes the arcsine of a number.

Panics

If the result is non-finite (caused if the magnitude of the input exceeds 1).

Computes the arccosine of a number.

Panics

If the result is non-finite (caused if the magnitude of the input exceeds 1).

Computes the arctangent of a number.

Attempts to compute the four quadrant arctangent of self (y) and other (x) in radians.

Errors

If the result is non-finite.

Computes the four quadrant arctangent of self (y) and other (x) in radians.

Panics

If the result is non-finite.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

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

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

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the /= operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Performs the *= operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Performs the %= operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.