Structureswift 6.0.1Swift
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 BitwiseCopyable
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 Copyable
A type whose values can be implicitly or explicitly copied.
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 Escapable
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
protocol SignedNumeric
A numeric type with a negation operation.
protocol Strideable<Stride>
A type representing continuous, one-dimensional values that can be offset and measured.
protocol TextOutputStreamable
A source of text-streaming operations.
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(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<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?<Source>(exactly: Source
) init(floatLiteral: Float
) init(from: any Decoder
) throws 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.
static func * (lhs: Float, rhs: Float
) -> Float static func *= (lhs: inout Float, rhs: Float
) static func + (lhs: Float, rhs: Float
) -> Float static func += (lhs: inout Float, rhs: Float
) static func - (x: Float
) -> Float static func - (lhs: Float, rhs: Float
) -> Float static func -= (lhs: inout Float, rhs: Float
) static func / (lhs: Float, rhs: Float
) -> Float static func /= (lhs: inout Float, rhs: Float
)
Instance members
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
func addProduct(Float, Float
) func advanced(by: Float
) -> Float func distance(to: Float
) -> Float func encode(to: any 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
)
Show obsolete interfaces (1)
Hide obsolete interfaces
var customPlaygroundQuickLook: _PlaygroundQuickLook
A custom playground Quick Look for the
Float
instance.
Type features
init<Source>(Source
) Creates a new instance from the given value, rounded to the closest possible representation.
init<Source>(Source
) Creates a new value, rounded to the closest possible representation.
init?<Source>(exactly: Source
) Creates a new instance from the given value, if it can be represented exactly.
init?<Source>(exactly: Source
) Creates a new value, if the given integer can be represented exactly.
init(integerLiteral: Self
) init(signOf: Self, magnitudeOf: Self
) static var radix: Int
static var ulpOfOne: Self
static var zero: Self
The zero value.
static func maximum(Self, Self
) -> Self static func maximumMagnitude(Self, Self
) -> Self static func minimum(Self, Self
) -> Self static func minimumMagnitude(Self, Self
) -> Self 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 != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.
static func + (x: Self
) -> Self Returns the given number unchanged.
static func += (lhs: inout Self, rhs: Self
) static func - (operand: Self
) -> Self Returns the additive inverse of the specified value.
static func -= (lhs: inout Self, rhs: Self
) static func ... (minimum: Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.
static func < (lhs: Self, rhs: Self
) -> Bool static func < (x: Self, y: Self
) -> Bool static func <= (lhs: Self, rhs: Self
) -> Bool static func <= (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func == (lhs: Self, rhs: Self
) -> Bool static func == (x: Self, y: Self
) -> Bool static func > (lhs: Self, rhs: Self
) -> Bool static func > (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (lhs: Self, rhs: Self
) -> Bool static func >= (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
Instance features
var floatingPointClass: FloatingPointClassification
var nextDown: Self
func addingProduct(Self, Self
) -> Self func isTotallyOrdered(belowOrEqualTo: Self
) -> Bool func negate(
) Replaces this value with its additive inverse.
func remainder(dividingBy: Self
) -> Self func round(
) func rounded(
) -> Self func rounded(FloatingPointRoundingRule
) -> Self func squareRoot(
) -> Self func truncatingRemainder(dividingBy: Self
) -> Self
Available in _Differentiation
Conformances
protocol Differentiable
A type that mathematically represents a differentiable manifold whose tangent spaces are finite-dimensional.
Typealiases
Instance members
Instance features
Available in Synchronization
Conformances
protocol AtomicRepresentable
A type that supports atomic operations through a separate atomic storage representation.
Typealiases
Type members
Available in Foundation
Type members
Show obsolete interfaces (1)
Hide obsolete interfaces
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
Type members
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
Show implementation details (1)
Hide implementation details
Type features
static func cosMinusOne(Self
) -> Self cos(x) - 1, computed in such a way as to maintain accuracy for small x.
static func exp10(Self
) -> Self static func signGamma(Self
) -> FloatingPointSign static func sqrt(Self
) -> Self static func / (a: Self, b: Self
) -> Self
Show implementation details (1)
Hide implementation details
Instance features
var reciprocal: Self?
The (approximate) reciprocal (multiplicative inverse) of this number, if it is representable.
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
.
Type features
static var defaultContentType: HTTPMediaType
static func decodeRequest(Request
) -> EventLoopFuture<Self> static func decodeRequest(Request
) async throws -> Self
Instance features
func afterDecode(
) throws func beforeEncode(
) throws func encodeResponse(for: Request
) -> EventLoopFuture<Response> func encodeResponse(status: HTTPStatus, headers: HTTPHeaders, for: Request
) -> EventLoopFuture<Response> Asynchronously encodes
Self
into aResponse
, setting the supplied status and headers.