amath  1.8.5
Simple command line calculator
asech.c File Reference

Inverse hyperbolic secant function. More...

#include "prim.h"
Include dependency graph for asech.c:

Go to the source code of this file.

Functions

double asech (double x)
 Inverse hyperbolic secant function. More...
 

Detailed Description

Inverse hyperbolic secant function.

Definition in file asech.c.

Function Documentation

◆ asech()

double asech ( double  x)

Inverse hyperbolic secant function.

Method
                    1+sqrt(1-x*x)
    asech(x) = ln( ------------— )
                          x
    when x <= 0
    asech(x) = NaN
    when x > 1
    asech(x) = NaN

Definition at line 52 of file asech.c.

References log(), and sqrt().

Referenced by RealNumber::HypArcSecant().

53 {
54  double a, b, c, d, e, f;
55 
56  if (TRIG_INEXACT(x) || x < 0.0 || x > 1.0)
57  {
58  return NAN;
59  }
60 
61  a = x * x;
62  b = 1.0 - a;
63  c = sqrt(b);
64  d = 1.0 + c;
65  e = d / x;
66  f = log(e);
67  return f;
68 }
#define TRIG_INEXACT(x)
Definition: prim.h:48
#define NAN
Definition: mathr.h:53
double sqrt(double x)
Square root function.
Definition: sqrt.c:119
double log(double x)
Natural logarithm function (base e)
Definition: log.c:109
Here is the call graph for this function:
Here is the caller graph for this function: