The **sinh()****function** in Swift** **returns the hyperbolic sine of a number.

The illustration below shows the mathematical representation of the `sinh()`

function.

Note: We need to import`Foundation`

in our code to use the`sinh()`

function. We can import it using`import Foundation`

.

```
sinh(num)
```

This function requires a number that represents an angle in radians as a parameter.

The following formula converts degrees to radians.

```
radians = degrees * ( pi / 180.0 )
```

`sinh()`

returns a number’s hyperbolic sine, which is sent as a parameter.

The code below shows us how to use the `sinh()`

function in Swift:

import Swiftimport Foundation//positive number in radiansprint("The value of sinh(2.3) :", sinh(2.3));// negative number in radiansprint("The value of sinh(-2.3) :", sinh(-2.3));//converting the degrees angle into radians and then applying sinh()// degrees = 90.0// PI = 3.14159265print("The value of sinh(90.0 * (PI / 180.0)) :", sinh(90.0 * (Double.pi / 180.0)));

- Line 2: We add the
`Foundation`

header required for`sinh()`

function. - Line 5: We calculate the hyperbolic sine of the positive number in radians using
`sinh()`

. - Line 8: We calculate the hyperbolic sine of the negative number in radians using
`sinh()`

.

- Line 13: We convert the angle in degrees to radians and then calculate its hyperbolic sine using
`sinh()`

.

TRENDING TOPICS