acoth

function acoth( x ) --> res

Description

Returns the inverse hyperbolic cotangent of x.

Parameters

x

The absoulute value must be greater than 1.

Return Values

res

The inverse hyperbolic cotangent of x, or NaN if x is less than 1.

Code

--ZFUNC-acoth-v1
local function acoth( x ) --> res
   return 0.5 * math.log( ( x+1 ) / ( x-1 ) )
end

return acoth

Examples

local t = require( "taptest" )
local acoth = require( "acoth" )
local isnan = require( "isnan" )
local round = require( "round" )

t( round( acoth( 6 ), 9 ), 0.168236118 )
t( isnan( acoth( 0 ) ), true )

t()