SignedNumberType

Instances of conforming types can be subtracted, arithmetically negated, and initialized from 0.

Axioms:

  • x - 0 == x
  • -x == 0 - x
  • -(-x) == x
Inheritance Comparable, Equatable, IntegerLiteralConvertible View Protocol Hierarchy →
Associated Types

1 inherited item hidden. (Show all)

Import
  • import Swift

Initializers

init(integerLiteral:) Required

Create an instance initialized to value.

Declaration

Declared In

IntegerLiteralConvertible

1 inherited item hidden. (Show all)

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
prefix func -(_:) Required

Return the result of negating x.

Declaration

  • prefix func -(x: Self) -> Self
func -(_:rhs:) Required

Return the difference between lhs and rhs.

Declaration

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

5 inherited items hidden. (Show all)