StructureSwift5.9.0
Float16
A half-precision (16b), floating-point value type.
- iOS
- 14.0+
- macOS
- 11.0+
- tvOS
- 14.0+
- watchOS
- 7.0+
@frozen struct Float16
Float16
is available on Apple silicon, and unavailable on Intel when targeting macOS.
Citizens in Swift
Conformances
protocol AdditiveArithmetic
A type with values that support addition and subtraction.
protocol BinaryFloatingPoint
A radix-2 (binary) floating-point type.
protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByFloatLiteral
A type that can be initialized with a floating-point literal.
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol FloatingPoint
A floating-point numeric type.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol LosslessStringConvertible
A type that can be represented as a string in a lossless, unambiguous way.
protocol Numeric
A type with values that support multiplication.
protocol SIMDScalar
A type that can be used as an element in a SIMD vector.
protocol Sendable
A type whose values can safely be passed across concurrency domains by copying.
protocol SignedNumeric
A numeric type with a negation operation.
protocol Strideable
A type representing continuous, one-dimensional values that can be offset and measured.
protocol TextOutputStreamable
A source of text-streaming operations.
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(Float80
) Creates a new instance that approximates the given value.
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?(exactly: Float80
) 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: Decoder
) throws Creates a new instance by decoding from the given decoder.
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.
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
static func * (Float16, Float16
) -> Float16 static func *= (inout Float16, Float16
) static func + (Float16, Float16
) -> Float16 static func += (inout Float16, Float16
) static func - (Float16
) -> Float16 static func - (Float16, Float16
) -> Float16 static func -= (inout Float16, Float16
) static func / (Float16, Float16
) -> Float16 static func /= (inout Float16, Float16
) func addProduct(Float16, Float16
) func advanced(by: Float16
) -> Float16 func distance(to: Float16
) -> Float16 func encode(to: Encoder
) throws Encodes this value into the given encoder.
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
) 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.
typealias Exponent
typealias Magnitude
typealias RawSignificand
typealias SIMDMaskScalar
Features
static func random(in: ClosedRange<Self>
) -> Self Returns a random value within the specified range.
static func random(in: Range<Self>
) -> Self Returns a random value within the specified range.
static func random<T>(in: ClosedRange<Self>, using: inout T
) -> Self Returns a random value within the specified range, using the given generator as a source for randomness.
static func random<T>(in: Range<Self>, using: inout T
) -> Self Returns a random value within the specified range, using the given generator as a source for randomness.
static func != (Self, Self
) -> Bool static func + (Self
) -> Self Returns the given number unchanged.
static func ... (Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (Self, Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (Self, Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.
static func < (Self, Self
) -> Bool static func <= (Self, Self
) -> Bool static func == (Self, Self
) -> Bool static func == (Self, Self
) -> Bool static func > (Self, Self
) -> Bool static func >= (Self, Self
) -> Bool func round(
) func rounded(
) -> Self
Available in _Differentiation
Conformances
protocol Differentiable
A type that mathematically represents a differentiable manifold whose tangent spaces are finite-dimensional.
Members
Extension in RealModule
Conformances
protocol AlgebraicField
A type modeling an algebraic field. Refines the
SignedNumeric
protocol, adding division.protocol ElementaryFunctions
A type that has elementary functions available.
protocol Real
A type that models the real numbers.
protocol RealFunctions
Members
static func acos(Float16
) -> Float16 static func acosh(Float16
) -> Float16 static func asin(Float16
) -> Float16 static func asinh(Float16
) -> Float16 static func atan(Float16
) -> Float16 static func atan2(y: Float16, x: Float16
) -> Float16 static func atanh(Float16
) -> Float16 static func cos(Float16
) -> Float16 static func cosh(Float16
) -> Float16 static func erf(Float16
) -> Float16 static func erfc(Float16
) -> Float16 static func exp(Float16
) -> Float16 static func exp10(Float16
) -> Float16 static func exp2(Float16
) -> Float16 static func expMinusOne(Float16
) -> Float16 static func gamma(Float16
) -> Float16 static func hypot(Float16, Float16
) -> Float16 static func log(Float16
) -> Float16 static func log(onePlus: Float16
) -> Float16 static func log10(Float16
) -> Float16 static func log2(Float16
) -> Float16 static func logGamma(Float16
) -> Float16 static func pow(Float16, Float16
) -> Float16 static func pow(Float16, Int
) -> Float16 static func root(Float16, Int
) -> Float16 static func sin(Float16
) -> Float16 static func sinh(Float16
) -> Float16 static func tan(Float16
) -> Float16 static func tanh(Float16
) -> Float16
Features
static func cosMinusOne(Self
) -> Self cos(x) - 1, computed in such a way as to maintain accuracy for small x.
static func sqrt(Self
) -> Self
Extension in SwiftSyntaxBuilder
Conformances
protocol ExpressibleByLiteralSyntax
A Swift type whose value can be represented directly in source code by a Swift literal.