amath  1.6.2
Simple command line calculator
asinh.c File Reference
#include "prim.h"
#include "math.h"
Include dependency graph for asinh.c:

Go to the source code of this file.

Functions

double asinh (double x)
 Inverse hyperbolic sine function. More...
 

Variables

static const double one = 1.00000000000000000000e+00
 
static const double ln2 = 6.93147180559945286227e-01
 
static const double huge = 1.00000000000000000000e+300
 

Function Documentation

double asinh ( double  x)

Inverse hyperbolic sine function.

Version
1.3
Date
95/01/18
Method :
 Based on
    asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
 we have
 asinh(x) := x  if  1+x*x=1,
     := sign(x)*(log(x)+ln2)) for large |x|, else
     := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
     := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))

Definition at line 73 of file asinh.c.

References huge, ln2, log1p(), one, and sqrt().

Referenced by RealNumber::HypArcCosecant(), and RealNumber::HypArcSine().

74 {
75  double t,w;
76  sword hx,ix;
77  GET_HIGH_WORD(hx,x);
78  ix = hx&0x7fffffff;
79  if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
80  if(ix< 0x3e300000) { /* |x|<2**-28 */
81  if(huge+x>one) return x; /* return x inexact except 0 */
82  }
83  if(ix>0x41b00000) { /* |x| > 2**28 */
84  w = log(fabs(x))+ln2;
85  } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */
86  t = fabs(x);
87  w = log(2.0*t+one/(sqrt(x*x+one)+t));
88  } else { /* 2.0 > |x| > 2**-28 */
89  t = x*x;
90  w =log1p(fabs(x)+t/(one+sqrt(one+t)));
91  }
92  if(hx>0) return w;
93  else return -w;
94 }
#define GET_HIGH_WORD(i, d)
Get the more significant 32 bit int from a double.
Definition: prim.h:165
double log1p(double x)
Definition: log1p.c:125
signed int sword
32 bit signed integer.
Definition: prim.h:107
double fabs(double x)
Returns the absolute value of x.
Definition: fabs.c:51
static const double ln2
Definition: asinh.c:49
static const double huge
Definition: asinh.c:50
static const double one
Definition: asinh.c:48
double sqrt(double x)
Square root function.
Definition: sqrt.c:127
double log(double x)
Natural logarithm function (base e).
Definition: log.c:118

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const double huge = 1.00000000000000000000e+300
static

Definition at line 50 of file asinh.c.

Referenced by asinh().

const double ln2 = 6.93147180559945286227e-01
static

Definition at line 49 of file asinh.c.

Referenced by asinh().

const double one = 1.00000000000000000000e+00
static

Definition at line 48 of file asinh.c.

Referenced by asinh().