Initializer

init(_:)

Creates a new instance initialized to the given value. 与えられた値に初期化される新しいインスタンスを作成します。

Declaration 宣言

init(_ other: Float)

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. otherの値は、新しいインスタンスによって正確に表されます。otherとして渡されるNaNは、シグナルNaN値はクワイエットNaNに変換されて、別のNaNという結果になります。


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


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

Relationships 関係

From Protocol 由来プロトコル

See Also 参照

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