Trusted answers to developer questions

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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)));

Calculating the hyperbolic sine of a number

- 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()`

.

RELATED TAGS

swift

communitycreator

CONTRIBUTOR

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Related Courses