Global Numeric Functions

Use these functions with numeric values and other comparable types.

Topics

Choosing the Smallest and Largest Value

func min<T>(T, T) -> T

Returns the lesser of two comparable values.

func min<T>(T, T, T, T...) -> T

Returns the least argument passed.

func max<T>(T, T) -> T

Returns the greater of two comparable values.

func max<T>(T, T, T, T...) -> T

Returns the greatest argument passed.

Finding the Absolute Value

func abs<T>(T) -> T

Returns the absolute value of the given number.

See Also

Advanced Numerics

Numeric Protocols

Write generic code that works with any numeric type.

Special-Use Numeric Types

Work with fixed-width numeric types of different sizes.

SIMD Vector Types

Work with fixed-width vectors of fixed-width numeric types of different sizes.