atanh
function atanh( x ) --> res
Description
Returns the inverse hyperbolic tangenent of x.
Parameters
- x
-
A number that should be between -1 and 1.
Return Values
- res
-
The inverse hyperbolic tangenent, or NaN if x is not between -1 and 1.
Code
--ZFUNC-atanh-v1 local function atanh( x ) --> res if x < -1 or x > 1 then return math.sqrt( -1 ) end return math.log( ( 1+x ) / ( 1-x ) ) / 2 end return atanh
Examples
local t = require( "tapered" ) local atanh = require( "atanh" ) -- util functions local round = require( "round" ) t.is( 1.00000001, round( atanh( 0.76159416 ), 8 ) ) t.is( -0.100335348, round( atanh( -0.1 ), 9 ) ) t.done()