1: /* replacement for asinh, acosh, and atanh */
2:
3: /*
4: Copyright (C) 1996,2000,2003,2007 Free Software Foundation, Inc.
5:
6: This file is part of Gforth.
7:
8: Gforth is free software; you can redistribute it and/or
9: modify it under the terms of the GNU General Public License
10: as published by the Free Software Foundation, either version 3
11: of the License, or (at your option) any later version.
12:
13: This program is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU General Public License for more details.
17:
18: You should have received a copy of the GNU General Public License
19: along with this program; if not, see http://www.gnu.org/licenses/.
20: */
21:
22: #include <math.h>
23:
24: double atanh(double r1)
25: {
26: double r2=r1 < 0 ? -r1 : r1;
27: double r3=log((r2/(1.0-r2)*2)+1)/2;
28:
29: return r1 < 0 ? -r3 : r3;
30: /* fdup f0< >r fabs 1. d>f fover f- f/ f2* flnp1 f2/
31: r> IF fnegate THEN ;
32: */
33: }
34:
35: double asinh(double r1)
36: {
37: return atanh(r1/sqrt(1.0+r1*r1));
38: /* fdup fdup f* 1. d>f f+ fsqrt f/ fatanh ; */
39: }
40:
41: double acosh(double r1)
42: {
43: return(log(r1+sqrt(r1*r1-1.0)));
44: /* fdup fdup f* 1. d>f f- fsqrt f+ fln ; */
45: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>