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( "tapered" )
local cosh = require( "cosh" )
-- util functions
local round = require( "round" )

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

t.done()

See also