Initializer

init(_:)

Creates a new instance initialized to the given value.

Declaration

init(_ other: Double)

Parameters

other

The value to use for the new instance.

Discussion

The value of other is represented exactly by the new instance. A NaN passed as other results in another NaN, with a signaling NaN value converted to quiet NaN.

let x: Double = 21.25
let y = Double(x)
// y == 21.25

let z = Double(Double.nan)
// z.isNaN == true

Relationships

From Protocol

See Also

Converting Floating-Point Values

init<Source>(Source)

Creates a new instance from the given value, rounded to the closest possible representation.

init(Float)

Creates a new instance that approximates the given value.

init(Float80)

Creates a new instance that approximates the given value.

init(CGFloat)

Creates a new instance initialized to the given value.

init(sign: FloatingPointSign, exponent: Int, significand: Double)

Creates a new value from the given sign, exponent, and significand.

init(signOf: Double, magnitudeOf: Double)

Creates a new floating-point value using the sign of one value and the magnitude of another.

init<Source>(Source)

Creates a new value, rounded to the closest possible representation.