FloatingPointType

protocol FloatingPointType

A set of common requirements for Swift's floating point types.

Inheritance Comparable, Equatable, Strideable, _Comparable, _Strideable View Protocol Hierarchy →
Associated Types
_BitsType
Stride : SignedNumberType

A type that can represent the distance between two values of Self

Import import Swift

Initializers

init(_: Int) Required

Create an instance initialized to value.

Declaration

init(_ value: Int)
init(_: Int8) Required

Create an instance initialized to value.

Declaration

init(_ value: Int8)
init(_: Int16) Required

Create an instance initialized to value.

Declaration

init(_ value: Int16)
init(_: Int32) Required

Create an instance initialized to value.

Declaration

init(_ value: Int32)
init(_: Int64) Required

Create an instance initialized to value.

Declaration

init(_ value: Int64)
init(_: UInt) Required

Create an instance initialized to value.

Declaration

init(_ value: UInt)
init(_: UInt8) Required

Create an instance initialized to value.

Declaration

init(_ value: UInt8)
init(_: UInt16) Required

Create an instance initialized to value.

Declaration

init(_ value: UInt16)
init(_: UInt32) Required

Create an instance initialized to value.

Declaration

init(_ value: UInt32)
init(_: UInt64) Required

Create an instance initialized to value.

Declaration

init(_ value: UInt64)

Static Variables

static var NaN: Self Required

A quiet NaN.

Declaration

static var NaN: Self { get }
static var infinity: Self Required

The positive infinity.

Declaration

static var infinity: Self { get }
static var quietNaN: Self Required

A quiet NaN.

Declaration

static var quietNaN: Self { get }

Instance Variables

var floatingPointClass: FloatingPointClassification Required

@{ IEEE 754-2008 Non-computational operations. The IEEE 754 "class" of this type.

Declaration

var floatingPointClass: FloatingPointClassification { get }
var isFinite: Bool Required

true iff self is zero, subnormal, or normal (not infinity or NaN).

Declaration

var isFinite: Bool { get }
var isInfinite: Bool Required

true iff self is infinity.

Declaration

var isInfinite: Bool { get }
var isNaN: Bool Required

true iff self is NaN.

Declaration

var isNaN: Bool { get }
var isNormal: Bool Required

true iff self is normal (not zero, subnormal, infinity, or NaN).

Declaration

var isNormal: Bool { get }
var isSignMinus: Bool Required

true iff self is negative

Declaration

var isSignMinus: Bool { get }
var isSignaling: Bool Required

true iff self is a signaling NaN.

Declaration

var isSignaling: Bool { get }
var isSubnormal: Bool Required

true iff self is subnormal.

Declaration

var isSubnormal: Bool { get }
var isZero: Bool Required

true iff self is +0.0 or -0.0.

Declaration

var isZero: Bool { get }

Static Methods

static func _fromBitPattern(_:) Required

Declaration

static func _fromBitPattern(bits: _BitsType) -> Self

Instance Methods

func <(_:rhs:) Required

A strict total order over instances of Self

Declaration

func <(lhs: Self, rhs: Self) -> Bool

Declared In

_Comparable
func <=(_:rhs:)

Declaration

func <=(lhs: Self, rhs: Self) -> Bool

Declared In

Comparable
func ==(_:rhs:) Required

Return true if lhs is equal to rhs.

Equality implies substitutability. When x == y, x and y are interchangeable in any code that only depends on their values.

Class instance identity as distinguished by triple-equals === is notably not part of an instance's value. Exposing other non-value aspects of Equatable types is discouraged, and any that are exposed should be explicitly pointed out in documentation.

Equality is an equivalence relation

  • x == x is true
  • x == y implies y == x
  • x == y and y == z implies x == z

Inequality is the inverse of equality, i.e. !(x == y) iff x != y

Declaration

func ==(lhs: Self, rhs: Self) -> Bool

Declared In

Equatable
func >(_:rhs:)

Declaration

func >(lhs: Self, rhs: Self) -> Bool

Declared In

Comparable
func >=(_:rhs:)

Declaration

func >=(lhs: Self, rhs: Self) -> Bool

Declared In

Comparable
func _toBitPattern() Required

Declaration

func _toBitPattern() -> _BitsType
func advancedBy(_:) Required

Returns a Self x such that self.distanceTo(x) approximates n.

Complexity: O(1).

See also: RandomAccessIndexType's advancedBy, which provides a stronger semantic guarantee.

Declaration

func advancedBy(n: Stride) -> Self

Declared In

_Strideable
func distanceTo(_:) Required

Returns a stride x such that self.advancedBy(x) approximates other.

Complexity: O(1).

See also: RandomAccessIndexType's distanceTo, which provides a stronger semantic guarantee.

Declaration

func distanceTo(other: Self) -> Stride

Declared In

_Strideable