Double
A double-precision, floating-point value type.
@frozen struct Double
A double-precision, floating-point value type.
@frozen struct Double
typealias Exponent
A type that can represent any written exponent.
typealias Magnitude
A type that can represent the absolute value of any possible value of the conforming type.
typealias RawSignificand
A type that represents the encoded significand of a value.
typealias SIMDMaskScalar
typealias TangentVector
A type representing a differentiable value’s derivatives.
init()
init<Source>(Source)
Creates a new instance from the given value, rounded to the closest possible representation.
init<Source>(Source)
Creates a new value, rounded to the closest possible representation.
init(Float80)
Creates a new instance that approximates the given value.
init(Float)
Creates a new instance that approximates the given value.
init(Double)
Creates a new instance initialized to the given value.
init?<S>(S)
Creates a new instance from the given string.
init<Source>(Source)
Creates a new value, rounded to the closest possible representation.
init?(Substring)
init(Float16)
Creates a new instance that approximates the given value.
init(Int)
Creates a new value, rounded to the closest possible representation.
init(bitPattern: UInt64)
Creates a new value with the given bit pattern.
init?<Source>(exactly: Source)
Creates a new value, if the given integer can be represented exactly.
init?<Source>(exactly: Source)
Creates a new instance from the given value, if it can be represented exactly.
init?(exactly: Float16)
Creates a new instance initialized to the given value, if it can be represented without rounding.
init?(exactly: Float80)
Creates a new instance initialized to the given value, if it can be represented without rounding.
init?(exactly: Double)
Creates a new instance initialized to the given value, if it can be represented without rounding.
init?<Source>(exactly: Source)
Creates a new value, if the given integer can be represented exactly.
init?(exactly: Float)
Creates a new instance initialized to the given value, if it can be represented without rounding.
init(floatLiteral: Double)
Creates an instance initialized to the specified floating-point value.
init(from: Decoder) throws
Creates a new instance by decoding from the given decoder.
init(integerLiteral: Int64)
Creates an instance initialized to the specified integer value.
init(integerLiteral: Self)
Creates an instance initialized to the specified integer value.
init(nan: Double.RawSignificand, signaling: Bool)
Creates a NaN (“not a number”) value with the specified payload.
init(sign: FloatingPointSign, exponent: Int, significand: Double)
Creates a new value from the given sign, exponent, and significand.
init(sign: FloatingPointSign, exponentBitPattern: UInt, significandBitPattern: UInt64)
Creates a new instance from the specified sign and bit patterns.
init(signOf: Self, magnitudeOf: Self)
Creates a new floating-point value using the sign of one value and the magnitude of another.
init(signOf: Double, magnitudeOf: Double)
Creates a new floating-point value using the sign of one value and the magnitude of another.
static var exponentBitCount: Int
The number of bits used to represent the type’s exponent.
static var greatestFiniteMagnitude: Double
The greatest finite number representable by this type.
static var infinity: Double
Positive infinity.
static var leastNonzeroMagnitude: Double
The least positive number.
static var leastNormalMagnitude: Double
The least positive normal number.
static var nan: Double
A quiet NaN (“not a number”).
static var pi: Double
The mathematical constant π, approximately equal to 3.14159.
static var radix: Int
The radix, or base of exponentiation, for a floating-point type.
static var signalingNaN: Double
A signaling NaN (“not a number”).
static var significandBitCount: Int
The available number of fractional significand bits.
static var ulpOfOne: Double
The unit in the last place of 1.0.
static var ulpOfOne: Self
The unit in the last place of 1.0.
static var zero: Self
The zero value.
static var allValueStrings: [String]
An array of all possible strings to that can convert to value of this type.
static var defaultCompletionKind: CompletionKind
The completion kind to use for options or arguments of this type that don’t explicitly declare a completion kind.
var binade: Double
The floating-point value with the same sign and exponent as this value, but with a significand of 1.0.
var bitPattern: UInt64
The bit pattern of the value’s encoding.
var customMirror: Mirror
A mirror that reflects the Double
instance.
var debugDescription: String
A textual representation of the value, suitable for debugging.
var description: String
A textual representation of the value.
var exponent: Int
The exponent of the floating-point value.
var exponentBitPattern: UInt
The raw encoding of the value’s exponent field.
var floatingPointClass: FloatingPointClassification
The classification of this value.
var isCanonical: Bool
A Boolean value indicating whether the instance’s representation is in its canonical form.
var isFinite: Bool
A Boolean value indicating whether this instance is finite.
var isInfinite: Bool
A Boolean value indicating whether the instance is infinite.
var isNaN: Bool
A Boolean value indicating whether the instance is NaN (“not a number”).
var isNormal: Bool
A Boolean value indicating whether this instance is normal.
var isSignalingNaN: Bool
A Boolean value indicating whether the instance is a signaling NaN.
var isSubnormal: Bool
A Boolean value indicating whether the instance is subnormal.
var isZero: Bool
A Boolean value indicating whether the instance is equal to zero.
var magnitude: Double
The magnitude of this value.
var nextDown: Self
The greatest representable value that compares less than this value.
var nextUp: Double
The least representable value that compares greater than this value.
var sign: FloatingPointSign
The sign of the floating-point value.
var significand: Double
The significand of the floating-point value.
var significandBitPattern: UInt64
The raw encoding of the value’s significand field.
var significandWidth: Int
The number of bits required to represent the value’s significand.
var ulp: Double
The unit in the last place of this value.
var reciprocal: Self?
Implementations should be conservative with the reciprocal property; it is OK to return nil
even in cases where a reciprocal could be represented. For this reason, a default implementation that simply always returns nil
is correct, but conforming types should provide a better implementation if possible.
var reciprocal: Self?
The (approximate) reciprocal (multiplicative inverse) of this number, if it is representable.
var defaultValueDescription: String
The description of this instance to show as a default value in a command-line tool’s help screen.
static func maximum(Self, Self) -> Self
Returns the greater of the two given values.
static func maximumMagnitude(Self, Self) -> Self
Returns the value with greater magnitude.
static func minimum(Self, Self) -> Self
Returns the lesser of the two given values.
static func minimumMagnitude(Self, Self) -> Self
Returns the value with lesser magnitude.
static func random(in: Range<Self>) -> Self
Returns a random value within the specified range.
static func random(in: ClosedRange<Self>) -> Self
Returns a random value within the specified range.
static func random<T>(in: Range<Self>, using: inout T) -> Self
Returns a random value within the specified range, using the given generator as a source for randomness.
static func random<T>(in: ClosedRange<Self>, using: inout T) -> Self
Returns a random value within the specified range, using the given generator as a source for randomness.
static func acos(Double) -> Double
The arccosine (inverse cosine) of x
.
static func acosh(Double) -> Double
The inverse hyperbolic cosine of x
.
static func asin(Double) -> Double
The arcsine (inverse sine) of x
.
static func asinh(Double) -> Double
The inverse hyperbolic sine of x
.
static func atan(Double) -> Double
The arctangent (inverse tangent) of x
.
static func atan2(y: Double, x: Double) -> Double
atan(y/x)
, with sign selected according to the quadrant of (x, y)
.
static func atanh(Double) -> Double
The inverse hyperbolic tangent of x
.
static func cos(Double) -> Double
The cosine of x
.
static func cosMinusOne(Self) -> Self
cos(x) - 1, computed in such a way as to maintain accuracy for small x.
static func cosh(Double) -> Double
The hyperbolic cosine of x
.
static func erf(Double) -> Double
The error function evaluated at x
.
static func erfc(Double) -> Double
The complimentary error function evaluated at x
.
static func exp(Double) -> Double
The exponential function e^x whose base e
is the base of the natural logarithm.
static func exp10(Self) -> Self
10^x
static func exp2(Double) -> Double
2^x
static func expMinusOne(Double) -> Double
exp(x) - 1, computed in such a way as to maintain accuracy for small x.
static func gamma(Double) -> Double
The gamma function Γ(x).
static func hypot(Double, Double) -> Double
sqrt(x*x + y*y)
, computed in a manner that avoids spurious overflow or underflow.
static func log(Double) -> Double
The natural logarithm of x
.
static func log(onePlus: Double) -> Double
log(1 + x), computed in such a way as to maintain accuracy for small x.
static func log10(Double) -> Double
The base-10 logarithm of x
.
static func log2(Double) -> Double
The base-2 logarithm of x
.
static func logGamma(Double) -> Double
The logarithm of the absolute value of the gamma function, log(|Γ(x)|).
static func pow(Double, Int) -> Double
x
raised to the nth power.
static func pow(Double, Double) -> Double
exp(y * log(x)) computed with additional internal precision.
static func root(Double, Int) -> Double
The nth root of x
.
static func signGamma(Self) -> FloatingPointSign
The sign of the gamma function, Γ(x).
static func sin(Double) -> Double
The sine of x
.
static func sinh(Double) -> Double
The hyperbolic sine of x
.
static func sqrt(Self) -> Self
The square root of x
.
static func tan(Double) -> Double
The tangent of x
.
static func tanh(Double) -> Double
The hyperbolic tangent of x
.
func addProduct(Double, Double)
Adds the product of the two given values to this value in place, computed without intermediate rounding.
func addingProduct(Self, Self) -> Self
Returns the result of adding the product of the two given values to this value, computed without intermediate rounding.
func advanced(by: Double) -> Double
Returns a value that is offset the specified distance from this value.
func distance(to: Double) -> Double
Returns the distance from this value to the given value, expressed as a stride.
func encode(to: Encoder) throws
Encodes this value into the given encoder.
func formRemainder(dividingBy: Double)
Replaces this value with the remainder of itself divided by the given value.
func formSquareRoot()
Replaces this value with its square root, rounded to a representable value.
func formTruncatingRemainder(dividingBy: Double)
Replaces this value with the remainder of itself divided by the given value using truncating division.
func hash(into: inout Hasher)
Hashes the essential components of this value by feeding them into the given hasher.
func isEqual(to: Double) -> Bool
Returns a Boolean value indicating whether this instance is equal to the given value.
func isLess(than: Double) -> Bool
Returns a Boolean value indicating whether this instance is less than the given value.
func isLessThanOrEqualTo(Double) -> Bool
Returns a Boolean value indicating whether this instance is less than or equal to the given value.
func isTotallyOrdered(belowOrEqualTo: Self) -> Bool
Returns a Boolean value indicating whether this instance should precede or tie positions with the given value in an ascending sort.
func negate()
Replaces this value with its additive inverse.
func negate()
Replaces this value with its additive inverse.
func remainder(dividingBy: Self) -> Self
Returns the remainder of this value divided by the given value.
func round()
func round(FloatingPointRoundingRule)
Rounds the value to an integral value using the specified rounding rule.
func rounded() -> Self
func rounded(FloatingPointRoundingRule) -> Self
Returns this value rounded to an integral value using the specified rounding rule.
func squareRoot() -> Self
Returns the square root of the value, rounded to a representable value.
func truncatingRemainder(dividingBy: Self) -> Self
Returns the remainder of this value divided by the given value using truncating division.
func write<Target>(to: inout Target)
Writes a textual representation of this instance into the given output stream.
func move(by: Self.TangentVector)
Moves self
by the given offset. In Riemannian geometry, this is equivalent to exponential map, which moves self
on the geodesic surface by the given tangent vector.
func move(by: Double.TangentVector)
Moves self
by the given offset. In Riemannian geometry, this is equivalent to exponential map, which moves self
on the geodesic surface by the given tangent vector.
static func != (Self, Self) -> Bool
static func * (Double, Double) -> Double
Multiplies two values and produces their product, rounding to a representable value.
static func *= (inout Double, Double)
Multiplies two values and stores the result in the left-hand-side variable, rounding to a representable value.
static func + (Self) -> Self
Returns the given number unchanged.
static func + (Double, Double) -> Double
Adds two values and produces their sum, rounded to a representable value.
static func += (inout Self, Self)
Adds two values and stores the result in the left-hand-side variable.
static func += (inout Double, Double)
Adds two values and stores the result in the left-hand-side variable, rounded to a representable value.
static func - (Double) -> Double
Calculates the additive inverse of a value.
static func - (Self) -> Self
Returns the additive inverse of the specified value.
static func - (Double, Double) -> Double
Subtracts one value from another and produces their difference, rounded to a representable value.
static func -= (inout Self, Self)
Subtracts the second value from the first and stores the difference in the left-hand-side variable.
static func -= (inout Double, Double)
Subtracts the second value from the first and stores the difference in the left-hand-side variable, rounding to a representable value.
static func ... (Self) -> PartialRangeThrough<Self>
Returns a partial range up to, and including, its upper bound.
static func ... (Self) -> PartialRangeFrom<Self>
Returns a partial range extending upward from a lower bound.
static func ... (Self, Self) -> ClosedRange<Self>
Returns a closed range that contains both of its bounds.
static func ..< (Self) -> PartialRangeUpTo<Self>
Returns a partial range up to, but not including, its upper bound.
static func ..< (Self, Self) -> Range<Self>
Returns a half-open range that contains its lower bound but not its upper bound.
static func / (Double, Double) -> Double
Returns the quotient of dividing the first value by the second, rounded to a representable value.
static func /= (inout Double, Double)
Divides the first value by the second and stores the quotient in the left-hand-side variable, rounding to a representable value.
static func < (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func < (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func <= (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func <= (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func == (Self, Self) -> Bool
Returns a Boolean value indicating whether two values are equal.
static func == (Self, Self) -> Bool
Returns a Boolean value indicating whether two values are equal.
static func > (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >= (Self, Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func / (Self, Self) -> Self
The (approximate) quotient a/b
.
struct SIMD16Storage
Storage for a vector of 16 floating-point values.
struct SIMD2Storage
Storage for a vector of two floating-point values.
struct SIMD32Storage
Storage for a vector of 32 floating-point values.
struct SIMD4Storage
Storage for a vector of four floating-point values.
struct SIMD64Storage
Storage for a vector of 64 floating-point values.
struct SIMD8Storage
Storage for a vector of eight floating-point values.
var customPlaygroundQuickLook: _PlaygroundQuickLook
A custom playground Quick Look for the Double
instance.