datanh.f

Go to the documentation of this file.
00001 *DECK DATANH
00002       DOUBLE PRECISION FUNCTION DATANH (X)
00003 C***BEGIN PROLOGUE  DATANH
00004 C***PURPOSE  Compute the arc hyperbolic tangent.
00005 C***LIBRARY   SLATEC (FNLIB)
00006 C***CATEGORY  C4C
00007 C***TYPE      DOUBLE PRECISION (ATANH-S, DATANH-D, CATANH-C)
00008 C***KEYWORDS  ARC HYPERBOLIC TANGENT, ATANH, ELEMENTARY FUNCTIONS,
00009 C             FNLIB, INVERSE HYPERBOLIC TANGENT
00010 C***AUTHOR  Fullerton, W., (LANL)
00011 C***DESCRIPTION
00012 C
00013 C DATANH(X) calculates the double precision arc hyperbolic
00014 C tangent for double precision argument X.
00015 C
00016 C Series for ATNH       on the interval  0.          to  2.50000E-01
00017 C                                        with weighted error   6.86E-32
00018 C                                         log weighted error  31.16
00019 C                               significant figures required  30.00
00020 C                                    decimal places required  31.88
00021 C
00022 C***REFERENCES  (NONE)
00023 C***ROUTINES CALLED  D1MACH, DCSEVL, INITDS, XERMSG
00024 C***REVISION HISTORY  (YYMMDD)
00025 C   770601  DATE WRITTEN
00026 C   890531  Changed all specific intrinsics to generic.  (WRB)
00027 C   890531  REVISION DATE from Version 3.2
00028 C   891214  Prologue converted to Version 4.0 format.  (BAB)
00029 C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
00030 C***END PROLOGUE  DATANH
00031       DOUBLE PRECISION X, ATNHCS(27), DXREL, SQEPS, Y, DCSEVL, D1MACH
00032       LOGICAL FIRST
00033       SAVE ATNHCS, NTERMS, DXREL, SQEPS, FIRST
00034       DATA ATNHCS(  1) / +.9439510239 3195492308 4289221863 3 D-1      /
00035       DATA ATNHCS(  2) / +.4919843705 5786159472 0003457666 8 D-1      /
00036       DATA ATNHCS(  3) / +.2102593522 4554327634 7932733175 2 D-2      /
00037       DATA ATNHCS(  4) / +.1073554449 7761165846 4073104527 6 D-3      /
00038       DATA ATNHCS(  5) / +.5978267249 2930314786 4278751787 2 D-5      /
00039       DATA ATNHCS(  6) / +.3505062030 8891348459 6683488620 0 D-6      /
00040       DATA ATNHCS(  7) / +.2126374343 7653403508 9621931443 1 D-7      /
00041       DATA ATNHCS(  8) / +.1321694535 7155271921 2980172305 5 D-8      /
00042       DATA ATNHCS(  9) / +.8365875501 1780703646 2360405295 9 D-10     /
00043       DATA ATNHCS( 10) / +.5370503749 3110021638 8143458777 2 D-11     /
00044       DATA ATNHCS( 11) / +.3486659470 1571079229 7124578429 0 D-12     /
00045       DATA ATNHCS( 12) / +.2284549509 6034330155 2402411972 2 D-13     /
00046       DATA ATNHCS( 13) / +.1508407105 9447930448 7422906755 8 D-14     /
00047       DATA ATNHCS( 14) / +.1002418816 8041091261 3699572283 7 D-15     /
00048       DATA ATNHCS( 15) / +.6698674738 1650695397 1552688298 6 D-17     /
00049       DATA ATNHCS( 16) / +.4497954546 4949310830 8332762453 3 D-18     /
00050       DATA ATNHCS( 17) / +.3032954474 2794535416 8236714666 6 D-19     /
00051       DATA ATNHCS( 18) / +.2052702064 1909368264 6386141866 6 D-20     /
00052       DATA ATNHCS( 19) / +.1393848977 0538377131 9301461333 3 D-21     /
00053       DATA ATNHCS( 20) / +.9492580637 2245769719 5895466666 6 D-23     /
00054       DATA ATNHCS( 21) / +.6481915448 2423076049 8244266666 6 D-24     /
00055       DATA ATNHCS( 22) / +.4436730205 7236152726 3232000000 0 D-25     /
00056       DATA ATNHCS( 23) / +.3043465618 5431616389 1200000000 0 D-26     /
00057       DATA ATNHCS( 24) / +.2091881298 7923934740 4799999999 9 D-27     /
00058       DATA ATNHCS( 25) / +.1440445411 2340505613 6533333333 3 D-28     /
00059       DATA ATNHCS( 26) / +.9935374683 1416404650 6666666666 6 D-30     /
00060       DATA ATNHCS( 27) / +.6863462444 3582600533 3333333333 3 D-31     /
00061       DATA FIRST /.TRUE./
00062 C***FIRST EXECUTABLE STATEMENT  DATANH
00063       IF (FIRST) THEN
00064          NTERMS = INITDS (ATNHCS, 27, 0.1*REAL(D1MACH(3)) )
00065          DXREL = SQRT(D1MACH(4))
00066          SQEPS = SQRT(3.0D0*D1MACH(3))
00067       ENDIF
00068       FIRST = .FALSE.
00069 C
00070       Y = ABS(X)
00071       IF (Y .GE. 1.D0) CALL XERMSG ('SLATEC', 'DATANH', 'ABS(X) GE 1',
00072      +   2, 2)
00073 C
00074       IF (1.D0-Y .LT. DXREL) CALL XERMSG ('SLATEC', 'DATANH',
00075      +   'ANSWER LT HALF PRECISION BECAUSE ABS(X) TOO NEAR 1', 1, 1)
00076 C
00077       DATANH = X
00078       IF (Y.GT.SQEPS .AND. Y.LE.0.5D0) DATANH = X*(1.0D0 +
00079      1  DCSEVL (8.D0*X*X-1.D0, ATNHCS, NTERMS) )
00080       IF (Y.GT.0.5D0) DATANH = 0.5D0*LOG ((1.0D0+X)/(1.0D0-X))
00081 C
00082       RETURN
00083       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines