File: atanh.c

package info (click to toggle)
gforth 0.3.0-4
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,972 kB
  • ctags: 743
  • sloc: ansic: 3,369; sh: 1,410; lisp: 725; makefile: 426; sed: 111
file content (26 lines) | stat: -rw-r--r-- 508 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* replacement for asinh, acosh, and atanh */

#include <math.h>

double atanh(double r1)
{
  double r2=r1 < 0 ? -r1 : r1;
  double r3=log((r2/(1.0-r2)*2)+1)/2;

  return r1 < 0 ? -r3 : r3;
  /* fdup f0< >r fabs 1. d>f fover f- f/  f2* flnp1 f2/
     r> IF  fnegate  THEN ;
     */
}

double asinh(double r1)
{
  return atanh(r1/sqrt(1.0+r1*r1));
  /* fdup fdup f* 1. d>f f+ fsqrt f/ fatanh ; */
}

double acosh(double r1)
{
  return(log(r1+sqrt(r1*r1-1.0)));
  /* fdup fdup f* 1. d>f f- fsqrt f+ fln ; */
}