Contents

init(_:)

Creates a new instance that approximates the given value.

Declaration

init(_ other: Float16)

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.

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

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

See Also

Converting Floating-Point Values