Float
A single-precision, floating-point value type.
@frozen struct Float
A single-precision, floating-point value type.
@frozen struct Float
import Swift
protocol AdditiveArithmetic : Equatable
A type with values that support addition and subtraction.
protocol BinaryFloatingPoint : ExpressibleByFloatLiteral, FloatingPoint
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 : Equatable
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 : Hashable, SignedNumeric, Strideable where Self == Self.Magnitude
A floating-point numeric type.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol LosslessStringConvertible : CustomStringConvertible
A type that can be represented as a string in a lossless, unambiguous way.
protocol Numeric : AdditiveArithmetic, ExpressibleByIntegerLiteral
A type with values that support multiplication.
protocol SIMDScalar : BitwiseCopyable
A type that can be used as an element in a SIMD vector.
protocol Sendable
protocol SignedNumeric : Numeric
A numeric type with a negation operation.
protocol Strideable<Stride> : Comparable
A type representing continuous, one-dimensional values that can be offset and measured.
protocol TextOutputStreamable
A source of text-streaming operations.
init()
init(_ other: Float)
Creates a new instance initialized to the given value.
init(_ other: Double)
Creates a new instance that approximates the given value.
init?(_ text: Substring)
init?<S>(_ text: S) where S : StringProtocol
Creates a new instance from the given string.
init(_ v: Int)
init(_ other: Float16)
Creates a new instance that approximates the given value.
init<Source>(_ value: Source) where Source : BinaryInteger
init(bitPattern: UInt32)
Creates a new value with the given bit pattern.
init?(exactly other: Double)
Creates a new instance initialized to the given value, if it can be represented without rounding.
init?(exactly other: Float)
Creates a new instance initialized to the given value, if it can be represented without rounding.
init?(exactly other: Float16)
Creates a new instance initialized to the given value, if it can be represented without rounding.
init?<Source>(exactly value: Source) where Source : BinaryInteger
init(floatLiteral value: Float)
init(from decoder: any Decoder) throws
init(integerLiteral value: Int64)
init(nan payload: 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 sign: Float, magnitudeOf mag: Float)
static var exponentBitCount: Int { get }
static var greatestFiniteMagnitude: Float { get }
static var infinity: Float { get }
static var leastNonzeroMagnitude: Float { get }
static var leastNormalMagnitude: Float { get }
static var nan: Float { get }
static var pi: Float { get }
static var signalingNaN: Float { get }
static var significandBitCount: Int { get }
static var ulpOfOne: Float { get }
The unit in the last place of 1.0.
var binade: Float { get }
var bitPattern: UInt32 { get }
The bit pattern of the value’s encoding.
var customMirror: Mirror { get }
A mirror that reflects the Float
instance.
var debugDescription: String { get }
A textual representation of the value, suitable for debugging.
var description: String { get }
A textual representation of the value.
var exponent: Int { get }
var exponentBitPattern: UInt { get }
var isCanonical: Bool { get }
var isFinite: Bool { get }
var isInfinite: Bool { get }
var isNaN: Bool { get }
var isNormal: Bool { get }
var isSignalingNaN: Bool { get }
var isSubnormal: Bool { get }
var isZero: Bool { get }
var magnitude: Float { get }
var nextUp: Float { get }
var sign: FloatingPointSign { get }
var significand: Float { get }
var significandBitPattern: UInt32 { get }
var significandWidth: Int { get }
var ulp: Float { get }
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)
mutating func addProduct(_ lhs: Float, _ rhs: Float)
func advanced(by amount: Float) -> Float
func distance(to other: Float) -> Float
func encode(to encoder: any Encoder) throws
Encodes this value into the given encoder.
mutating func formRemainder(dividingBy other: Float)
mutating func formSquareRoot()
mutating func formTruncatingRemainder(dividingBy other: Float)
func hash(into hasher: inout Hasher)
func isEqual(to other: Float) -> Bool
func isLess(than other: Float) -> Bool
func isLessThanOrEqualTo(_ other: Float) -> Bool
mutating func negate()
mutating func round(_ rule: FloatingPointRoundingRule)
func write<Target>(to target: inout Target) where Target : TextOutputStream
@frozen struct SIMD16Storage
Storage for a vector of 16 floating-point values.
@frozen struct SIMD2Storage
Storage for a vector of two floating-point values.
@frozen struct SIMD32Storage
Storage for a vector of 32 floating-point values.
@frozen struct SIMD4Storage
Storage for a vector of four floating-point values.
@frozen struct SIMD64Storage
Storage for a vector of 64 floating-point values.
@frozen struct SIMD8Storage
Storage for a vector of eight floating-point values.
typealias Exponent = Int
typealias Magnitude = Float
typealias RawSignificand = UInt32
typealias SIMDMaskScalar = Int32
var customPlaygroundQuickLook: _PlaygroundQuickLook { get }
A custom playground Quick Look for the Float
instance.
init<Source>(_ value: Source) where Source : BinaryFloatingPoint
Creates a new instance from the given value, rounded to the closest possible representation.
init<Source>(_ value: Source) where Source : BinaryInteger
Creates a new value, rounded to the closest possible representation.
init?<Source>(exactly value: Source) where Source : BinaryFloatingPoint
Creates a new instance from the given value, if it can be represented exactly.
init?<Source>(exactly value: Source) where Source : BinaryInteger
Creates a new value, if the given integer can be represented exactly.
init(integerLiteral value: Self)
init(signOf: Self, magnitudeOf: Self)
static var radix: Int { get }
static var ulpOfOne: Self { get }
static var zero: Self { get }
The zero value.
static func maximum(_ x: Self, _ y: Self) -> Self
static func maximumMagnitude(_ x: Self, _ y: Self) -> Self
static func minimum(_ x: Self, _ y: Self) -> Self
static func minimumMagnitude(_ x: Self, _ y: Self) -> Self
static func random(in range: ClosedRange<Self>) -> Self
Returns a random value within the specified range.
static func random(in range: Range<Self>) -> Self
Returns a random value within the specified range.
static func random<T>(in range: ClosedRange<Self>, using generator: inout T) -> Self where T : RandomNumberGenerator
Returns a random value within the specified range, using the given generator as a source for randomness.
static func random<T>(in range: Range<Self>, using generator: inout T) -> Self where T : RandomNumberGenerator
Returns a random value within the specified range, using the given generator as a source for randomness.
var floatingPointClass: FloatingPointClassification { get }
var nextDown: Self { get }
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.
func addingProduct(_ lhs: Self, _ rhs: Self) -> Self
func isTotallyOrdered(belowOrEqualTo other: Self) -> Bool
mutating func negate()
Replaces this value with its additive inverse.
func remainder(dividingBy other: Self) -> Self
mutating func round()
func rounded() -> Self
func rounded(_ rule: FloatingPointRoundingRule) -> Self
func squareRoot() -> Self
func truncatingRemainder(dividingBy other: Self) -> Self
import _Differentiation
protocol Differentiable
A type that mathematically represents a differentiable manifold whose tangent spaces are finite-dimensional.
mutating func move(by offset: Float.TangentVector)
typealias TangentVector = Float
mutating func move(by offset: Self.TangentVector)
import Synchronization
protocol AtomicRepresentable
A type that supports atomic operations through a separate atomic storage representation.
static func decodeAtomicRepresentation(_ representation: consuming Float.AtomicRepresentation) -> Float
static func encodeAtomicRepresentation(_ value: consuming Float) -> Float.AtomicRepresentation
typealias AtomicRepresentation
import Foundation
init(_ value: CGFloat)
init?(exactly number: NSNumber)
init(truncating number: NSNumber)
init(_ number: NSNumber)
import MultipartKit
Parser, serializer, and Codable
support for multipart/form-data
.
protocol MultipartPartConvertible
A protocol to provide custom behaviors for parsing and serializing types from and to multipart data.
init?(multipart: MultipartPart)
var multipart: MultipartPart? { get }
import RealModule
protocol AlgebraicField : SignedNumeric
A type modeling an algebraic field. Refines the SignedNumeric
protocol, adding division.
protocol ElementaryFunctions : AdditiveArithmetic
A type that has elementary functions available.
protocol Real : AlgebraicField, RealFunctions, FloatingPoint
A type that models the real numbers.
protocol RealFunctions : ElementaryFunctions
static func _mulAdd(_ a: Float, _ b: Float, _ c: Float) -> Float
static func acos(_ x: Float) -> Float
static func acosh(_ x: Float) -> Float
static func asin(_ x: Float) -> Float
static func asinh(_ x: Float) -> Float
static func atan(_ x: Float) -> Float
static func atan2(y: Float, x: Float) -> Float
static func atanh(_ x: Float) -> Float
static func cos(_ x: Float) -> Float
static func cosh(_ x: Float) -> Float
static func erf(_ x: Float) -> Float
static func erfc(_ x: Float) -> Float
static func exp(_ x: Float) -> Float
static func exp2(_ x: Float) -> Float
static func expMinusOne(_ x: Float) -> Float
static func gamma(_ x: Float) -> Float
static func hypot(_ x: Float, _ y: Float) -> Float
static func log(_ x: Float) -> Float
static func log(onePlus x: Float) -> Float
static func log10(_ x: Float) -> Float
static func log2(_ x: Float) -> Float
static func logGamma(_ x: Float) -> Float
static func pow(_ x: Float, _ y: Float) -> Float
static func pow(_ x: Float, _ n: Int) -> Float
static func root(_ x: Float, _ n: Int) -> Float
static func sin(_ x: Float) -> Float
static func sinh(_ x: Float) -> Float
static func tan(_ x: Float) -> Float
static func tanh(_ x: Float) -> Float
static func _mulAdd(_ a: Self, _ b: Self, _ c: Self) -> Self
static func cosMinusOne(_ x: Self) -> Self
cos(x) - 1, computed in such a way as to maintain accuracy for small x.
static func exp10(_ x: Self) -> Self
static func signGamma(_ x: Self) -> FloatingPointSign
static func sqrt(_ x: Self) -> Self
var reciprocal: Self? { get }
The (approximate) reciprocal (multiplicative inverse) of this number, if it is representable.
static func / (a: Self, b: Self) -> Self
import SwiftSyntaxBuilder
SwiftSyntaxBuilder is a tool for generating Swift code in a convenient way using result builders.
protocol ExpressibleByLiteralSyntax
A Swift type whose value can be represented directly in source code by a Swift literal.
func makeLiteralSyntax() -> ExprSyntax
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
protocol AsyncRequestDecodable
Can convert Request
to a Self
.
protocol AsyncResponseEncodable
Can convert self
to a Response
.
protocol Content : Decodable, Encodable, Sendable, AsyncRequestDecodable, AsyncResponseEncodable, RequestDecodable, ResponseEncodable
Convertible to / from content in an HTTP message.
protocol RequestDecodable
Can convert Request
to a Self
.
protocol ResponseEncodable
Can convert self
to a Response
.
static var defaultContentType: HTTPMediaType { get }
static func decodeRequest(_ request: Request) -> EventLoopFuture<Self>
static func decodeRequest(_ request: Request) async throws -> Self
mutating func afterDecode() throws
mutating func beforeEncode() throws
func encodeResponse(for request: Request) -> EventLoopFuture<Response>
func encodeResponse(status: HTTPStatus, headers: HTTPHeaders = [:], for request: Request) -> EventLoopFuture<Response>
Asynchronously encodes Self
into a Response
, setting the supplied status and headers.
import Yams
protocol NodeRepresentable
Type is representable as Node
.
protocol ScalarConstructible
Types conforming to this protocol can be extracted Node.Scalar
s.
protocol ScalarRepresentable : NodeRepresentable
Type is representable as Node.scalar
.
protocol SexagesimalConvertible : ExpressibleByIntegerLiteral
Confirming types are convertible to base 60 numeric values.
protocol YAMLEncodable : Encodable
Types conforming to this protocol can be encoded by YamlEncoder
.
func box() -> Node
Returns this value wrapped in a Node.scalar
.
func represented() -> Node.Scalar
static func construct(from scalar: Node.Scalar) -> Self?
Construct an instance of FloatingPoint & SexagesimalConvertible
, if possible, from the specified scalar.
static func create(from string: String) -> Self?
Creates a sexagesimal numeric value from the given string.