Annotation of gforth/engine/atanh.c, revision 1.2

1.1       anton       1: /* replacement for asinh, acosh, and atanh */
                      2: 
1.2     ! anton       3: /* 
        !             4:   Copyright (C) 1996 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 2
        !            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, write to the Free Software
        !            20:   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
        !            21: */
        !            22: 
1.1       anton      23: #include <math.h>
                     24: 
                     25: double atanh(double r1)
                     26: {
                     27:   double r2=r1 < 0 ? -r1 : r1;
                     28:   double r3=log((r2/(1.0-r2)*2)+1)/2;
                     29: 
                     30:   return r1 < 0 ? -r3 : r3;
                     31:   /* fdup f0< >r fabs 1. d>f fover f- f/  f2* flnp1 f2/
                     32:      r> IF  fnegate  THEN ;
                     33:      */
                     34: }
                     35: 
                     36: double asinh(double r1)
                     37: {
                     38:   return atanh(r1/sqrt(1.0+r1*r1));
                     39:   /* fdup fdup f* 1. d>f f+ fsqrt f/ fatanh ; */
                     40: }
                     41: 
                     42: double acosh(double r1)
                     43: {
                     44:   return(log(r1+sqrt(r1*r1-1.0)));
                     45:   /* fdup fdup f* 1. d>f f- fsqrt f+ fln ; */
                     46: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>