Float
A single-precision (32-bit), floating-point value type.
Declaration
@frozen struct FloatTopics
Converting Integers
Converting Strings
Converting Floating-Point Values
init(_:)init(_:)init(_:)init(_:)init(_:)init(_:)init(_:)init(signOf:magnitudeOf:)init(sign:exponent:significand:)init(truncating:)
Converting with No Loss of Precision
Creating a Random Value
Performing Calculations
Floating-Point Operators for FloataddingProduct(_:_:)addProduct(_:_:)squareRoot()formSquareRoot()remainder(dividingBy:)formRemainder(dividingBy:)truncatingRemainder(dividingBy:)formTruncatingRemainder(dividingBy:)negate()
Rounding Values
Comparing Values
Floating-Point Operators for FloatisEqual(to:)isLess(than:)isLessThanOrEqualTo(_:)isTotallyOrdered(belowOrEqualTo:)maximum(_:_:)maximumMagnitude(_:_:)minimum(_:_:)minimumMagnitude(_:_:)
Finding the Sign and Magnitude
Querying a Float
Accessing Numeric Constants
piinfinitygreatestFiniteMagnitudenansignalingNaNulpOfOneleastNormalMagnitudeleastNonzeroMagnitudezero
Working with Binary Representation
bitPatternsignificandBitPatternsignificandWidthexponentBitPatternsignificandBitCountexponentBitCountradixinit(bitPattern:)init(sign:exponentBitPattern:significandBitPattern:)init(nan:signaling:)Float.ExponentFloat.RawSignificand
Querying a Float’s State
Encoding and Decoding Values
Creating a Range
Describing a Float
SIMD-Supporting Types
Float.SIMDMaskScalarFloat.SIMD2StorageFloat.SIMD4StorageFloat.SIMD8StorageFloat.SIMD16StorageFloat.SIMD32StorageFloat.SIMD64Storage
Infrequently Used Functionality
init()init(integerLiteral:)init(floatLiteral:)init(integerLiteral:)advanced(by:)distance(to:)write(to:)
Deprecated
Type Properties
Default Implementations
AdditiveArithmetic ImplementationsAtomicRepresentable ImplementationsBinaryFloatingPoint ImplementationsComparable ImplementationsCustomDebugStringConvertible ImplementationsCustomReflectable ImplementationsCustomStringConvertible ImplementationsDecodable ImplementationsEncodable ImplementationsEquatable ImplementationsExpressibleByFloatLiteral ImplementationsExpressibleByIntegerLiteral ImplementationsFloatingPoint ImplementationsHashable ImplementationsLosslessStringConvertible ImplementationsNumeric ImplementationsOperationParameter ImplementationsSIMDScalar ImplementationsSignedNumeric ImplementationsStrideable ImplementationsTextOutputStreamable Implementations