acosh
function acosh( x ) --> res
Description
Returns the inverse hyperbolic cosine of x. The inverse hyperbolic cosine is the value whose hyperbolic cosine is x, so acosh( cosh( x ) ) equals x.
Parameters
- x
-
Real number that must be greater or equal to 1.
Return Values
- res
-
The inverse hyperbolic cosine of x or NaN if x < 1.
Code
--ZFUNC-acosh-v1 local function acosh( x ) --> res if x < 1 then return math.sqrt( -1 ) end return math.log( x + math.sqrt( x+1 ) * math.sqrt( x-1 ) ) end return acosh
Examples
local t = require( "taptest" ) local acosh = require( "acosh" ) local isnan = require( "isnan" ) local round = require( "round" ) t( acosh( 1 ), 0 ) t( round( acosh( 10 ), 7 ), 2.9932228 ) t( isnan( acosh( 0 ) ), true ) t()