#[repr(transparent)]pub struct F128Bits(pub u128);
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
use fixed::{types::I16F16, F128Bits};
// binary128 representation for 1.0 is 0x3FFF << 112
let one = F128Bits(0x3FFF_u128 << 112);
assert_eq!(I16F16::ONE.to_num::<F128Bits>(), one);
assert_eq!(I16F16::from_num(one), I16F16::ONE);
// fixed-point numbers can be compared directly to F128Bits values
assert!(I16F16::from_num(1.5) > one);
assert!(I16F16::from_num(0.5) < one);
Tuple Fields
0: u128
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.
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, 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.
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any precision (lossless).
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any precision (lossless).
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any precision (lossless).
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any precision (lossless).
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any precision (lossless).
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any precision (lossless).
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any precision (lossless).
Converts a fixed-point number to a floating-point number.
This conversion actually never fails (infallible) but does not lose any 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 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.
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
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.
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
impl RefUnwindSafe for F128Bits
impl UnwindSafe for F128Bits
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
Performs the conversion.
Performs the conversion.
Casts the value.
OverflowingCasts the value.
Casts the value.
Casts the value.
Casts the value.
UnwrappedCasts the value.
Casts the value.
WrappingCasts the value.