# ElementaryFunctions

``public protocol ElementaryFunctions``

A type that has elementary functions available.

An “elementary function” is a function built up from powers, roots, exponentials, logarithms, trigonometric functions (sin, cos, tan) and their inverses, and the hyperbolic functions (sinh, cosh, tanh) and their inverses.

Conformance to this protocol means that all of these building blocks are available as static functions on the type.

``````let x: Float = 1
let y = Float.sin(x) // 0.84147096
``````
• ``` sqrt(_:) ```

The square root of `x`.

For real types, if the argument is negative, either the result is NaN or a precondition failure occurs. For complex types, this function has a branch cut along the negative real axis.

#### Declaration

``static func sqrt(_ x: Self) -> Self``
• ``` cos(_:) ```

The cosine of `x`.

For real types, `x` is interpreted as an angle measured in radians.

#### Declaration

``static func cos(_ x: Self) -> Self``
• ``` sin(_:) ```

The sine of `x`.

For real types, `x` is interpreted as an angle measured in radians.

#### Declaration

``static func sin(_ x: Self) -> Self``
• ``` tan(_:) ```

The tangent of `x`.

#### Declaration

``static func tan(_ x: Self) -> Self``
• ``` acos(_:) ```

The acos function.

#### Declaration

``static func acos(_ x: Self) -> Self``
• ``` asin(_:) ```

The asin function.

#### Declaration

``static func asin(_ x: Self) -> Self``
• ``` atan(_:) ```

The atan function.

#### Declaration

``static func atan(_ x: Self) -> Self``
• ``` cosh(_:) ```

The cosh function.

#### Declaration

``static func cosh(_ x: Self) -> Self``
• ``` sinh(_:) ```

The sinh function.

#### Declaration

``static func sinh(_ x: Self) -> Self``
• ``` tanh(_:) ```

The tanh function.

#### Declaration

``static func tanh(_ x: Self) -> Self``
• ``` acosh(_:) ```

The acosh function.

#### Declaration

``static func acosh(_ x: Self) -> Self``
• ``` asinh(_:) ```

The asinh function.

#### Declaration

``static func asinh(_ x: Self) -> Self``
• ``` atanh(_:) ```

The atanh function.

#### Declaration

``static func atanh(_ x: Self) -> Self``
• ``` exp(_:) ```

The exp function.

#### Declaration

``static func exp(_ x: Self) -> Self``
• ``` exp2(_:) ```

The exp2 function.

#### Declaration

``static func exp2(_ x: Self) -> Self``
• ``` exp10(_:) ```

The exp10 function.

#### Declaration

``static func exp10(_ x: Self) -> Self``
• ``` expm1(_:) ```

The expm1 function.

#### Declaration

``static func expm1(_ x: Self) -> Self``
• ``` log(_:) ```

The log function.

#### Declaration

``static func log(_ x: Self) -> Self``
• ``` log2(_:) ```

The log2 function.

#### Declaration

``static func log2(_ x: Self) -> Self``
• ``` log10(_:) ```

The log10 function.

#### Declaration

``static func log10(_ x: Self) -> Self``
• ``` log1p(_:) ```

The log1p function.

#### Declaration

``static func log1p(_ x: Self) -> Self``
• ``` pow(_:_:) ```

`exp(y log(x))` computed without loss of intermediate precision.

For real types, if `x` is negative the result is NaN, even if `y` has an integral value. For complex types, there is a branch cut on the negative real axis.

#### Declaration

``static func pow(_ x: Self, _ y: Self) -> Self``
• ``` pow(_:_:) ```

`x` raised to the `n`th power.

#### Declaration

``static func pow(_ x: Self, _ n: Int) -> Self``
• ``` root(_:_:) ```

The `n`th root of `x`.

For real types, if `x` is negative and `n` is even, the result is NaN. For complex types, there is a branch cut along the negative real axis.

#### Declaration

``static func root(_ x: Self, _ n: Int) -> Self``