cosh

function cosh( x ) --> res

Description

Returns the hyperbolic cosine of x.

Parameters

x

An angle in radians.

Return Values

res

Hyperbolic cosine of x.

Code

--ZFUNC-cosh-v1
local function cosh( x ) --> res
   return ( math.exp( x ) + math.exp( -x ) ) / 2
end

return cosh

Examples

local t = require( "taptest" )
local cosh = require( "cosh" )
local round = require( "round" )

t( round( cosh( 4 ), 6 ), 27.308233 )
t( round( cosh( math.exp( 1 ) ), 7 ), 7.6101251 )

t()

See also