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

t.is( 0.168236118, round( acoth( 6 ), 9 ) )
t.ok( isnan( acoth( 0 ) ) )

t.done()