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

The bit representation of a binary128 floating-point number (f128).

This type can be used to

  • convert between fixed-point numbers and the bit representation of 128-bit floating-point numbers.
  • compare fixed-point numbers and the bit representation of 128-bit floating-point numbers.

Examples

#![feature(generic_const_exprs)]

use fixed::{types::I16F16, F128};
assert_eq!(I16F16::ONE.to_num::<F128>(), F128::ONE);
assert_eq!(I16F16::from_num(F128::ONE), I16F16::ONE);

// fixed-point numbers can be compared directly to F128 values
assert!(I16F16::from_num(1.5) > F128::ONE);
assert!(I16F16::from_num(0.5) < F128::ONE);

Implementations

Zero.

Negative zero (−0).

One.

Negative one (−1).

Smallest positive subnormal number.

Smallest positive normal number.

Largest finite number.

Smallest finite number; equal to −MAX.

Infinity (∞).

Negative infinity (−∞).

NaN.

The radix or base of the internal representation.

Number of significant digits in base 2.

The difference between 1 and the next larger representable number.

If x = MIN_EXP, then normal numbers ≥ 0.5 × 2x.

If x = MAX_EXP, then normal numbers < 1 × 2x.

Raw transmutation from u128.

Examples
use fixed::F128;
let infinity_bits = 0x7FFF_u128 << 112;
assert!(F128::from_bits(infinity_bits - 1).is_finite());
assert!(!F128::from_bits(infinity_bits).is_finite());

Raw transmutation to u128.

Examples
use fixed::F128;
assert_eq!(F128::ONE.to_bits(), 0x3FFF_u128 << 112);
assert_ne!(F128::ONE.to_bits(), 1u128);

Creates a number from a byte array in big-endian byte order.

Creates a number from a byte array in little-endian byte order.

Creates a number from a byte array in native-endian byte order.

Returns the memory representation of the number as a byte array in big-endian byte order.

Returns the memory representation of the number as a byte array in little-endian byte order.

Returns the memory representation of the number as a byte array in native-endian byte order.

Returns true if the number is NaN.

Example
use fixed::F128;

assert!(F128::NAN.is_nan());

assert!(!F128::ONE.is_nan());
assert!(!F128::INFINITY.is_nan());
assert!(!F128::NEG_INFINITY.is_nan());

Returns true if the number is infinite.

Example
use fixed::F128;

assert!(F128::INFINITY.is_infinite());
assert!(F128::NEG_INFINITY.is_infinite());

assert!(!F128::ONE.is_infinite());
assert!(!F128::NAN.is_infinite());

Returns true if the number is neither infinite nor NaN.

Example
use fixed::F128;

assert!(F128::ONE.is_finite());
assert!(F128::MAX.is_finite());

assert!(!F128::INFINITY.is_finite());
assert!(!F128::NEG_INFINITY.is_finite());
assert!(!F128::NAN.is_finite());

Returns true if the number is zero.

Example
use fixed::F128;

assert!(F128::ZERO.is_zero());
assert!(F128::NEG_ZERO.is_zero());

assert!(!F128::MIN_POSITIVE_SUB.is_zero());
assert!(!F128::NAN.is_zero());

Returns true if the number is subnormal.

Example
use fixed::F128;

assert!(F128::MIN_POSITIVE_SUB.is_subnormal());

assert!(!F128::ZERO.is_subnormal());
assert!(!F128::MIN_POSITIVE.is_subnormal());

Returns true if the number is neither zero, infinite, subnormal, or NaN.

Example
use fixed::F128;

assert!(F128::MIN.is_normal());
assert!(F128::MIN_POSITIVE.is_normal());
assert!(F128::MAX.is_normal());

assert!(!F128::ZERO.is_normal());
assert!(!F128::MIN_POSITIVE_SUB.is_normal());
assert!(!F128::INFINITY.is_normal());
assert!(!F128::NAN.is_normal());

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.

Example
use core::num::FpCategory;
use fixed::F128;

assert_eq!(F128::ZERO.classify(), FpCategory::Zero);
assert_eq!(F128::MIN_POSITIVE_SUB.classify(), FpCategory::Subnormal);
assert_eq!(F128::MIN_POSITIVE.classify(), FpCategory::Normal);
assert_eq!(F128::INFINITY.classify(), FpCategory::Infinite);
assert_eq!(F128::NAN.classify(), FpCategory::Nan);

Returns the absolute value of the number.

The only difference possible between the input value and the returned value is in the sign bit, which is always cleared in the return value.

Example
use fixed::F128;

// -0 == +0, but -0 bits != +0 bits
assert_eq!(F128::NEG_ZERO, F128::ZERO);
assert_ne!(F128::NEG_ZERO.to_bits(), F128::ZERO.to_bits());
assert_eq!(F128::NEG_ZERO.abs().to_bits(), F128::ZERO.to_bits());

assert_eq!(F128::NEG_INFINITY.abs(), F128::INFINITY);
assert_eq!(F128::MIN.abs(), F128::MAX);

assert!(F128::NAN.abs().is_nan());

Returns a number that represents the sign of the input value.

  • 1 if the number is positive, +0, or +∞
  • −1 if the number is negative, −0, or −∞
  • NaN if the number is NaN
Example
use fixed::F128;

assert_eq!(F128::ONE.signum(), F128::ONE);
assert_eq!(F128::INFINITY.signum(), F128::ONE);
assert_eq!(F128::NEG_ZERO.signum(), F128::NEG_ONE);
assert_eq!(F128::MIN.signum(), F128::NEG_ONE);

assert!(F128::NAN.signum().is_nan());

Returns a number composed of the magnitude of self and the sign of sign.

Example
use fixed::F128;

assert_eq!(F128::ONE.copysign(F128::NEG_ZERO), F128::NEG_ONE);
assert_eq!(F128::ONE.copysign(F128::ZERO), F128::ONE);
assert_eq!(F128::NEG_ONE.copysign(F128::NEG_INFINITY), F128::NEG_ONE);
assert_eq!(F128::NEG_ONE.copysign(F128::INFINITY), F128::ONE);

assert!(F128::NAN.copysign(F128::ONE).is_nan());
assert!(F128::NAN.copysign(F128::ONE).is_sign_positive());
assert!(F128::NAN.copysign(F128::NEG_ONE).is_sign_negative());

Returns true if the number has a positive sign, including +0, +∞, and NaN without a negative sign bit.

Example
use fixed::F128;

assert!(F128::ZERO.is_sign_positive());
assert!(F128::MAX.is_sign_positive());
assert!(F128::INFINITY.is_sign_positive());

assert!(!F128::NEG_ZERO.is_sign_positive());
assert!(!F128::MIN.is_sign_positive());
assert!(!F128::NEG_INFINITY.is_sign_positive());

Returns true if the number has a negative sign, including −0, −∞, and NaN with a negative sign bit.

Example
use fixed::F128;

assert!(F128::NEG_ZERO.is_sign_negative());
assert!(F128::MIN.is_sign_negative());
assert!(F128::NEG_INFINITY.is_sign_negative());

assert!(!F128::ZERO.is_sign_negative());
assert!(!F128::MAX.is_sign_negative());
assert!(!F128::INFINITY.is_sign_negative());

Returns the ordering between self and other.

Unlike the PartialOrd implementation, this method always returns an order in the following sequence:

  • NaN with the sign bit set
  • −∞
  • negative normal numbers
  • negative subnormal numbers
  • −0
  • +0
  • positive subnormal numbers
  • positive normal numbers
  • +∞
  • NaN with the sign bit cleared
Example
use core::cmp::Ordering;
use fixed::F128;

let neg_nan = F128::NAN.copysign(F128::NEG_ONE);
let pos_nan = F128::NAN.copysign(F128::ONE);
let neg_inf = F128::NEG_INFINITY;
let pos_inf = F128::INFINITY;
let neg_zero = F128::NEG_ZERO;
let pos_zero = F128::ZERO;

assert_eq!(neg_nan.total_cmp(&neg_inf), Ordering::Less);
assert_eq!(pos_nan.total_cmp(&pos_inf), Ordering::Greater);
assert_eq!(neg_zero.total_cmp(&pos_zero), Ordering::Less);

Trait Implementations

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

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

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) and does not lose any precision (lossless).

Converts a fixed-point number to a floating-point number.

Rounding is to the nearest, with ties rounded to even.

Panics

When debug assertions are enabled, panics if the value does not fit. When debug assertions are not enabled, the wrapped value can be returned, but it is not considered a breaking change if in the future it panics; if wrapping is required use wrapping_from_fixed instead.

Converts a fixed-point number to a floating-point number if it fits, otherwise returns None.

Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number, saturating if it does not fit.

Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number, wrapping if it does not fit.

Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

Returns a tuple of the value and a bool indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number, panicking if it does not fit.

Rounding is to the nearest, with ties rounded to even.

Panics

Panics if the value does not fit, even when debug assertions are not enabled.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts a fixed-point number to a floating-point number.

This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion actually never fails (infallible) and does not lose precision (lossless).

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts a fixed-point number to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts an integer to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts an integer to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) and actually does not lose precision (lossless).

Converts an integer to a floating-point number.

This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.

The resulting type after applying the - operator.

Performs the unary - operation. Read more

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Converts a floating-point number to a fixed-point number.

Rounding is to the nearest, with ties rounded to even.

Panics

Panics if self is not finite.

When debug assertions are enabled, also panics if the value does not fit. When debug assertions are not enabled, the wrapped value can be returned, but it is not considered a breaking change if in the future it panics; if wrapping is required use wrapping_to_fixed instead.

Converts a floating-point number to a fixed-point number if it fits, otherwise returns None.

Rounding is to the nearest, with ties rounded to even.

Converts a floating-point number to a fixed-point number, saturating if it does not fit.

Rounding is to the nearest, with ties rounded to even.

Panics

Panics if self is NaN.

Converts a floating-point number to a fixed-point number, wrapping if it does not fit.

Rounding is to the nearest, with ties rounded to even.

Panics

Panics if self is not finite.

Converts a floating-point number to a fixed-point number.

Returns a tuple of the fixed-point number and a bool indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

Rounding is to the nearest, with ties rounded to even.

Panics

Panics if self is not finite.

Converts a floating-point number to a fixed-point number, panicking if it does not fit.

Rounding is to the nearest, with ties rounded to even.

Panics

Panics if self is not finite or if the value does not fit, even when debug assertions are not enabled.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

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

Performs the conversion.

Performs the conversion.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

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.

Casts the value.

Casts the value.

Casts the value.

Casts the value.