Initializer

init(_:)

Creates a new instance that approximates the given value. 与えられた値におおよそ相当する新しいインスタンスを作成します。

Declaration 宣言

init(_ other: Double)

Parameters パラメータ

other

The value to use for the new instance. 新しいインスタンスのために使う値。

Discussion 解説

The value of other is rounded to a representable value, if necessary. A NaN passed as other results in another NaN, with a signaling NaN value converted to quiet NaN. otherの値は、必要ならば、表現可能な値へと丸められます。otherとして渡されるNaNは、シグナルNaN値はクワイエットNaNに変換されて、別のNaNという結果になります。


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


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

Relationships 関係

From Protocol 由来プロトコル

See Also 参照

Converting Floating-Point Values 浮動小数点値の変換