StructureFoundation5.9.0
CGFloat
@frozen struct CGFloat
Citizens in Foundation
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 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 Numeric
A type with values that support multiplication.
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.
Members
init(
) init(CGFloat
) init(Double
) init(Float
) init(Int
) Creates a new value, rounded to the closest possible representation.
init(UInt
) Creates a new value, rounded to the closest possible representation.
init(Int8
) Creates a new value, rounded to the closest possible representation.
init(Int16
) Creates a new value, rounded to the closest possible representation.
init(Int32
) Creates a new value, rounded to the closest possible representation.
init(Int64
) Creates a new value, rounded to the closest possible representation.
init(UInt8
) Creates a new value, rounded to the closest possible representation.
init(UInt16
) Creates a new value, rounded to the closest possible representation.
init(UInt32
) Creates a new value, rounded to the closest possible representation.
init(UInt64
) Creates a new value, rounded to the closest possible representation.
init(Float80
) init(bitPattern: UInt
) init?<T>(exactly: T
) init(floatLiteral: CGFloat.NativeType
) Create an instance initialized to
value
.init(from: Decoder
) throws init(integerLiteral: Int
) Create an instance initialized to
value
.init(nan: CGFloat.RawSignificand, signaling: Bool
) init(sign: FloatingPointSign, exponent: Int, significand: CGFloat
) init(sign: FloatingPointSign, exponentBitPattern: UInt, significandBitPattern: UInt
) static var exponentBitCount: Int
static var greatestFiniteMagnitude: CGFloat
static var infinity: CGFloat
static var leastNonzeroMagnitude: CGFloat
static var leastNormalMagnitude: CGFloat
static var nan: CGFloat
static var pi: CGFloat
static var signalingNaN: CGFloat
static var significandBitCount: Int
var binade: CGFloat
var bitPattern: UInt
var customMirror: Mirror
Returns a mirror that reflects
self
.var description: String
A textual representation of
self
.var exponent: Int
var exponentBitPattern: UInt
var floatingPointClass: FloatingPointClassification
var hashValue: Int
The hash value.
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: CGFloat
var native: CGFloat.NativeType
The native value.
var nextUp: CGFloat
var sign: FloatingPointSign
var significand: CGFloat
var significandBitPattern: UInt
var significandWidth: Int
var ulp: CGFloat
static func * (CGFloat, CGFloat
) -> CGFloat static func *= (inout CGFloat, CGFloat
) static func + (CGFloat, CGFloat
) -> CGFloat static func += (inout CGFloat, CGFloat
) static func - (CGFloat, CGFloat
) -> CGFloat static func -= (inout CGFloat, CGFloat
) static func / (CGFloat, CGFloat
) -> CGFloat static func /= (inout CGFloat, CGFloat
) func addProduct(CGFloat, CGFloat
) func advanced(by: CGFloat
) -> CGFloat Returns a
Self
x
such thatself.distance(to: x)
approximatesn
.func distance(to: CGFloat
) -> CGFloat Returns a stride
x
such thatself.advanced(by: x)
approximatesother
.func encode(to: Encoder
) throws func formRemainder(dividingBy: CGFloat
) func formSquareRoot(
) func formTruncatingRemainder(dividingBy: CGFloat
) func hash(into: inout Hasher
) func isEqual(to: CGFloat
) -> Bool func isLess(than: CGFloat
) -> Bool func isLessThanOrEqualTo(CGFloat
) -> Bool func negate(
) func round(FloatingPointRoundingRule
) typealias Exponent
typealias NativeType
The native type used to store the CGFloat, which is Float on 32-bit architectures and Double on 64-bit architectures.
typealias RawSignificand
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.
var halfWidthCornerQuoted: String
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