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 thesinh()
function. We can import it usingimport 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)));
Foundation
header required for sinh()
function.sinh()
.sinh()
.sinh()
.