- import java.lang.Math.*;
- class Demoatanh
- {
- double atanh(double x)
- {
- return 0.5*Math.log( (x + 1.0) / (x - 1.0));
- }
- public static void main(String args[])
- {
- Demoatanh d =new Demoatanh();
- double x= -2.0;
- double res = d.atanh(x);
- System.out.println(res );
- }
- }
Output: |
---|
-0.5493061443340549 |