pub struct Double(pub u64);Expand description
An IEEE binary64 bit pattern. The sign occupies bit 63, the biased exponent bits 52–62 (bias 1023), and the fraction bits 0–51. Finite normal values have 53 significant bits. Equality compares encodings.
Tuple Fields§
§0: u64Implementations§
Source§impl Double
impl Double
Sourcepub fn add<N: NanPolicy<Double>>(
self,
addend: Double,
rounding: Rounding,
) -> Computed<Double>
pub fn add<N: NanPolicy<Double>>( self, addend: Double, rounding: Rounding, ) -> Computed<Double>
Adds the operands. Opposite infinities give the default NaN with INVALID.
Exact cancellation gives −0 under round-toward-negative and +0 otherwise.
Two zeros of the same sign keep that sign. NaNs use crate::nan::NanPolicy::choose.
Sourcepub fn subtract<N: NanPolicy<Double>>(
self,
subtrahend: Double,
rounding: Rounding,
) -> Computed<Double>
pub fn subtract<N: NanPolicy<Double>>( self, subtrahend: Double, rounding: Rounding, ) -> Computed<Double>
Subtracts the second operand. Like-signed infinities give the default NaN with INVALID. Zero signs follow addition with the second sign reversed. NaN selection receives the original operands in subtraction order.
Source§impl Double
impl Double
Sourcepub fn to_i32(
self,
rounding: Rounding,
) -> Result<Rounded<i32>, InvalidConversion>
pub fn to_i32( self, rounding: Rounding, ) -> Result<Rounded<i32>, InvalidConversion>
Rounds to a signed integer, then checks the destination range. Returns
crate::InvalidConversion for NaN, infinity or an out-of-range rounded
value. On success, inexact records a discarded nonzero fraction.
Sourcepub fn to_i64(
self,
rounding: Rounding,
) -> Result<Rounded<i64>, InvalidConversion>
pub fn to_i64( self, rounding: Rounding, ) -> Result<Rounded<i64>, InvalidConversion>
Rounds to a signed integer, then checks the destination range. Returns
crate::InvalidConversion for NaN, infinity or an out-of-range rounded
value. On success, inexact records a discarded nonzero fraction.
Sourcepub fn from_i64(value: i64) -> Computed<Self>
pub fn from_i64(value: i64) -> Computed<Self>
Converts an i64 to this format. Zero finishes as +0. Nonzero inputs return an exact intermediate to round at the destination precision.
Source§impl Double
impl Double
Sourcepub fn divide<N: NanPolicy<Double>>(self, divisor: Double) -> Computed<Double>
pub fn divide<N: NanPolicy<Double>>(self, divisor: Double) -> Computed<Double>
Divides by the second operand. Zero divided by zero and infinity divided by
infinity give the default NaN with INVALID. A finite nonzero dividend over zero
gives signed infinity with DIVIDE_BY_ZERO. NaNs use crate::nan::NanPolicy::choose.
For other operands the quotient sign is the exclusive OR of the signs.
Source§impl Double
impl Double
Sourcepub fn next_up(self) -> Self
pub fn next_up(self) -> Self
Returns the next representable value toward positive infinity. Either signed zero steps to the smallest positive subnormal. Positive infinity and every NaN retain their exact bit patterns.
Sourcepub fn next_down(self) -> Self
pub fn next_down(self) -> Self
Returns the next representable value toward negative infinity. Either signed zero steps to the smallest negative subnormal. Negative infinity and every NaN retain their exact bit patterns.
Sourcepub fn is_denormal(self) -> bool
pub fn is_denormal(self) -> bool
Returns true for a zero exponent field with a nonzero fraction.
Trait Implementations§
impl Copy for Double
impl Eq for Double
Source§impl NanPolicy<Double> for X86
impl NanPolicy<Double> for X86
Source§fn is_signalling(value: Double) -> bool
fn is_signalling(value: Double) -> bool
Source§fn quiet(value: Double) -> (Double, Flags)
fn quiet(value: Double) -> (Double, Flags)
value for a unary operation. Return the result and
Flags::INVALID if the operation signals invalid, or Flags::NONE otherwise.Source§fn choose(first: Double, second: Double) -> (Double, Flags)
fn choose(first: Double, second: Double) -> (Double, Flags)
Flags::INVALID if the policy signals invalid, or
Flags::NONE otherwise. Subtraction passes the original signs.Source§fn export(value: Double) -> Payload
fn export(value: Double) -> Payload
Source§fn import(payload: Payload) -> (Double, Flags)
fn import(payload: Payload) -> (Double, Flags)
Flags::INVALID if this
conversion signals invalid operation, or Flags::NONE otherwise.Source§impl Real for Double
impl Real for Double
Source§const DEFAULT_NAN: Self
const DEFAULT_NAN: Self
Source§fn is_signalling_nan(value: Self) -> bool
fn is_signalling_nan(value: Self) -> bool
Source§fn is_denormal(value: Self) -> bool
fn is_denormal(value: Self) -> bool
Source§fn add(a: Self, b: Self, rounding: Rounding) -> Computed<Self>
fn add(a: Self, b: Self, rounding: Rounding) -> Computed<Self>
crate::Single::add for the operand cases.
NaNs and exceptions follow the x86 rules.Source§fn subtract(a: Self, b: Self, rounding: Rounding) -> Computed<Self>
fn subtract(a: Self, b: Self, rounding: Rounding) -> Computed<Self>
crate::Single::subtract for the operand cases.
NaNs and exceptions follow the x86 rules.Source§fn multiply(a: Self, b: Self) -> Computed<Self>
fn multiply(a: Self, b: Self) -> Computed<Self>
crate::Single::multiply for the operand cases.
NaNs and exceptions follow the x86 rules.Source§fn divide(a: Self, b: Self) -> Computed<Self>
fn divide(a: Self, b: Self) -> Computed<Self>
crate::Single::divide for the operand cases.
NaNs and exceptions follow the x86 rules.Source§fn sqrt(a: Self) -> Computed<Self>
fn sqrt(a: Self) -> Computed<Self>
crate::Single::sqrt for the operand cases.
NaNs and exceptions follow the x86 rules.Source§fn compare(a: Self, b: Self, signalling: bool) -> (Relation, Flags)
fn compare(a: Self, b: Self, signalling: bool) -> (Relation, Flags)
crate::Single::compare for the operand cases.
NaNs and exceptions follow the x86 rules.