PHP atanh() Function


Definition and Usage

The atanh() function returns the inverse hyperbolic tangent ratio of given given parameter. In other words, the return value of atanh() is hyperbolic tangent of given parameter. A inverse hyperbolic tangent function is defined as .

atanh(x) = 0.5Xlog((1+x)/(1-x))

This function returns a float value .

Syntax

atanh ( float $arg ) : float

Parameters

Sr.NoParameter & Description
1arg
A floating point value whose inverse hyperbolic tangent is to be calculated

Return Values

PHP atanh() function returns inverse hyperbolic tangent ratio of given parameter.

PHP Version

This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.

Example

 Live Demo

Following example calculates atanh(pi/4) and returns which is also the result of formula definition −

<?php
   $arg=M_PI_4;
   $res=atanh($arg);
   echo "atanh(pi) = " . $res . "
";    $val = 0.5*log((1+$arg)/(1-$arg));    echo "using formula = " . $val; ?>

Output

This will produce following result −

atanh(pi) = 1.0593061708232
using formula = 1.0593061708232

Example

 Live Demo

Following example computes atanh(Π/10) −

<?php
   $arg=M_PI/10;;
   $val=atanh($arg);
   echo "atanh(" . $arg . ") = " . $val;
?>

Output

This will produce following result −

atanh(0.31415926535898) = 0.32515348134414

Example

 Live Demo

Let's check find out atanh(0). It returns 0 −

<?php
   $arg=0;
   $val=atanh($arg);
   echo "atanh(" . $arg . ") = " . $val;
?>

Output

This will produce following result −

atanh(0) = 0

Example

 Live Demo

For parameter = 1 atanh() function returns INF

<?php
   $arg=1;
   $val=atanh($arg);
   echo "atanh(" . $arg . ") = " . $val;
?>

Output

This will produce following result −

atanh(1) = INF

Updated on: 29-Jun-2020

120 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements