SignedNumber

protocol SignedNumber

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, ExpressibleByIntegerLiteral View Protocol Hierarchy →
Associated Types
IntegerLiteralType
Import import Swift

Initializers

init(integerLiteral:) Required

Create an instance initialized to value.

Declaration

init(integerLiteral value: Self.IntegerLiteralType)

Declared In

ExpressibleByIntegerLiteral

Instance Methods

func <(_:rhs:) Required

Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

This function is the only requirement of the Comparable protocol. The remainder of the relational operator functions are implemented by the standard library for any type that conforms to Comparable.

Parameters: lhs: A value to compare. rhs: Another value to compare.

Declaration

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

Declared In

Comparable
func <=(_:rhs:)

Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.

Parameters: lhs: A value to compare. rhs: Another value to compare.

Declaration

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

Declared In

Comparable
func ==(_:rhs:) Required

Returns a Boolean value indicating whether two values are equal.

Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

Parameters: lhs: A value to compare. rhs: Another value to compare.

Declaration

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

Declared In

Equatable
func >(_:rhs:)

Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

Parameters: lhs: A value to compare. rhs: Another value to compare.

Declaration

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

Declared In

Comparable
func >=(_:rhs:)

Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.

Parameters: lhs: A value to compare. rhs: Another value to compare.

Declaration

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

Declared In

Comparable
prefix func -(_:) Required

Returns the result of negating x.

Declaration

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

Returns the difference between lhs and rhs.

Declaration

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