Swift Tutorial Swift Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

Swift - asinh() Function



The Swift asinh() function returns inverse hyperbolic sine of a value. The inverse hyperbolic sine of x is defined as:

asinh

Syntax

In Foundation framework, it is defined as follows:

public func asinh(_ x: CGFloat) -> CGFloat
public func asinh(_ x: Float) -> Float
public func asinh(_ x: Float80) -> Float80
public func asinh(_ __x: Double) -> Double

Parameters

x Specify the value.

Return Value

Returns the inverse hyperbolic sine of a value.

Example:

In the example below, asinh() function is used to find out the hyperbolic sine of a value.

import Foundation

print("asinh(0.0) = \(asinh(0.0))")
print("asinh(2.0) = \(asinh(2.0))")
print("asinh(4.0) = \(asinh(4.0))")
print("asinh(8.0) = \(asinh(8.0))")

The output of the above code will be:

asinh(0.0) = 0.0
asinh(2.0) = 1.4436354751788103
asinh(4.0) = 2.0947125472611012
asinh(8.0) = 2.7764722807237177

❮ Swift Math Functions

5