Contents

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

See Also

Converting Floating-Point Values