Instance Methodswift 6.0.1Swift
encode(to:)
Encodes this value into the given encoder.
- iOS
- 14.0+
- macOS
- 11.0+
- tvOS
- 14.0+
- watchOS
- 7.0+
func encode(to encoder: any Encoder) throws
Parameters
- encoder
The encoder to write data to.
This function throws an error if any values are invalid for the given encoder’s format.
Other members in extension
Types
struct SIMD16Storage
Storage for a vector of 16 floating-point values.
struct SIMD2Storage
Storage for a vector of two floating-point values.
struct SIMD32Storage
Storage for a vector of 32 floating-point values.
struct SIMD4Storage
Storage for a vector of four floating-point values.
struct SIMD64Storage
Storage for a vector of 64 floating-point values.
struct SIMD8Storage
Storage for a vector of eight floating-point values.
Typealiases
Type members
init(
) init(Float16
) Creates a new instance initialized to the given value.
init(Double
) Creates a new instance that approximates the given value.
init(Float
) Creates a new instance that approximates the given value.
init?(Substring
) init?<S>(S
) Creates a new instance from the given string.
init(Int
) init<Source>(Source
) init(bitPattern: UInt16
) Creates a new value with the given bit pattern.
init?(exactly: Float16
) Creates a new instance initialized to the given value, if it can be represented without rounding.
init?(exactly: Double
) Creates a new instance initialized to the given value, if it can be represented without rounding.
init?(exactly: Float
) Creates a new instance initialized to the given value, if it can be represented without rounding.
init?<Source>(exactly: Source
) init(floatLiteral: Float16
) init(from: any Decoder
) throws init(integerLiteral: Int64
) init(nan: Float16.RawSignificand, signaling: Bool
) Creates a NaN (“not a number”) value with the specified payload.
init(sign: FloatingPointSign, exponent: Int, significand: Float16
) init(sign: FloatingPointSign, exponentBitPattern: UInt, significandBitPattern: UInt16
) init(signOf: Float16, magnitudeOf: Float16
) static var exponentBitCount: Int
static var greatestFiniteMagnitude: Float16
static var infinity: Float16
static var leastNonzeroMagnitude: Float16
static var leastNormalMagnitude: Float16
static var nan: Float16
static var pi: Float16
static var signalingNaN: Float16
static var significandBitCount: Int
static var ulpOfOne: Float16
The unit in the last place of 1.0.
static func * (lhs: Float16, rhs: Float16
) -> Float16 static func *= (lhs: inout Float16, rhs: Float16
) static func + (lhs: Float16, rhs: Float16
) -> Float16 static func += (lhs: inout Float16, rhs: Float16
) static func - (x: Float16
) -> Float16 static func - (lhs: Float16, rhs: Float16
) -> Float16 static func -= (lhs: inout Float16, rhs: Float16
) static func / (lhs: Float16, rhs: Float16
) -> Float16 static func /= (lhs: inout Float16, rhs: Float16
)
Instance members
var binade: Float16
var bitPattern: UInt16
The bit pattern of the value’s encoding.
var debugDescription: String
A textual representation of the value, suitable for debugging.
var description: String
A textual representation of the value.
var exponent: Int
var exponentBitPattern: UInt
var isCanonical: Bool
var isFinite: Bool
var isInfinite: Bool
var isNaN: Bool
var isNormal: Bool
var isSignalingNaN: Bool
var isSubnormal: Bool
var isZero: Bool
var magnitude: Float16
var nextUp: Float16
var sign: FloatingPointSign
var significand: Float16
var significandBitPattern: UInt16
var significandWidth: Int
var ulp: Float16
func addProduct(Float16, Float16
) func advanced(by: Float16
) -> Float16 func distance(to: Float16
) -> Float16 func formRemainder(dividingBy: Float16
) func formSquareRoot(
) func formTruncatingRemainder(dividingBy: Float16
) func hash(into: inout Hasher
) func isEqual(to: Float16
) -> Bool func isLess(than: Float16
) -> Bool func isLessThanOrEqualTo(Float16
) -> Bool func negate(
) func round(FloatingPointRoundingRule
) func write<Target>(to: inout Target
)