Float
A single-precision, floating-point value type.
@frozen struct Float
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 CVarArg
A type whose instances can be encoded, and appropriately passed, as elements of a C
va_list
.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 CustomReflectable
A type that explicitly supplies its own mirror.
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(Float
) Creates a new instance initialized to the given value.
init(Double
) 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(Float16
) Creates a new instance that approximates the given value.
init(Float80
) Creates a new instance that approximates the given value.
init<Source>(Source
) init(bitPattern: UInt32
) Creates a new value with the given bit pattern.
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: Float16
) 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: Float
) init(from: Decoder
) throws Creates a new instance by decoding from the given decoder.
init(integerLiteral: Int64
) init(nan: Float.RawSignificand, signaling: Bool
) Creates a NaN (“not a number”) value with the specified payload.
init(sign: FloatingPointSign, exponent: Int, significand: Float
) init(sign: FloatingPointSign, exponentBitPattern: UInt, significandBitPattern: UInt32
) init(signOf: Float, magnitudeOf: Float
) static var exponentBitCount: Int
static var greatestFiniteMagnitude: Float
static var infinity: Float
static var leastNonzeroMagnitude: Float
static var leastNormalMagnitude: Float
static var nan: Float
static var pi: Float
static var signalingNaN: Float
static var significandBitCount: Int
static var ulpOfOne: Float
The unit in the last place of 1.0.
var binade: Float
var bitPattern: UInt32
The bit pattern of the value’s encoding.
var customMirror: Mirror
A mirror that reflects the
Float
instance.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: Float
var nextUp: Float
var sign: FloatingPointSign
var significand: Float
var significandBitPattern: UInt32
var significandWidth: Int
var ulp: Float
static func * (Float, Float
) -> Float static func *= (inout Float, Float
) static func + (Float, Float
) -> Float static func += (inout Float, Float
) static func - (Float
) -> Float static func - (Float, Float
) -> Float static func -= (inout Float, Float
) static func / (Float, Float
) -> Float static func /= (inout Float, Float
) func addProduct(Float, Float
) func advanced(by: Float
) -> Float func distance(to: Float
) -> Float func encode(to: Encoder
) throws Encodes this value into the given encoder.
func formRemainder(dividingBy: Float
) func formSquareRoot(
) func formTruncatingRemainder(dividingBy: Float
) func hash(into: inout Hasher
) func isEqual(to: Float
) -> Bool func isLess(than: Float
) -> Bool func isLessThanOrEqualTo(Float
) -> 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
var customPlaygroundQuickLook: _PlaygroundQuickLook
A custom playground Quick Look for the
Float
instance.
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
Available in Foundation
Members
Extension in MultipartKit
Conformances
Members
Extension in ArgumentParser
Conformances
protocol ExpressibleByArgument
A type that can be expressed as a command-line argument.
Extension in JSONDecoding
Conformances
protocol JSONDecodable
A type that can be decoded from a JSON variant value.
Members
Extension in BSONDecoding
Conformances
protocol BSONDecodable
A type that can be decoded from a BSON variant value backed by some type of storage not particular to the decoded type.
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 _mulAdd(Float, Float, Float
) -> Float static func acos(Float
) -> Float static func acosh(Float
) -> Float static func asin(Float
) -> Float static func asinh(Float
) -> Float static func atan(Float
) -> Float static func atan2(y: Float, x: Float
) -> Float static func atanh(Float
) -> Float static func cos(Float
) -> Float static func cosh(Float
) -> Float static func erf(Float
) -> Float static func erfc(Float
) -> Float static func exp(Float
) -> Float static func exp2(Float
) -> Float static func expMinusOne(Float
) -> Float static func gamma(Float
) -> Float static func hypot(Float, Float
) -> Float static func log(Float
) -> Float static func log(onePlus: Float
) -> Float static func log10(Float
) -> Float static func log2(Float
) -> Float static func logGamma(Float
) -> Float static func pow(Float, Float
) -> Float static func pow(Float, Int
) -> Float static func root(Float, Int
) -> Float static func sin(Float
) -> Float static func sinh(Float
) -> Float static func tan(Float
) -> Float static func tanh(Float
) -> Float
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.
Extension in JSONDecoding
Conformances
protocol JSONDecodable
A type that can be decoded from a JSON variant value.
Members
Extension in Vapor
Conformances
protocol AsyncRequestDecodable
Can convert
Request
to aSelf
.protocol AsyncResponseEncodable
Can convert
self
to aResponse
.protocol Content
Convertible to / from content in an HTTP message.
protocol RequestDecodable
Can convert
Request
to aSelf
.protocol ResponseEncodable
Can convert
self
to aResponse
.
Features
func encodeResponse(status: HTTPStatus, headers: HTTPHeaders, for: Request
) -> EventLoopFuture<Response> Asynchronously encodes
Self
into aResponse
, setting the supplied status and headers.