       .TITLE TANH   HYPERBOLIC TANGENT FOR REAL ARGUMENT
/COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/EDIT 1   10-22-70
       .GLOBL TANH,.DA,.AG,.AA,.AB,.EF,.AI,.AN,.AM
/             CALLING SEQUENCE    TANH(X)=1-(2/(1+E**2X))
/      JMS*   (TANH)          SUBR CALL
/      JMP    .+2             SUBR RETURN
/      CAL/XCT ADDR           ADDR OF ARG (XCT IF INDIRECT
/      NEXT   INSTRUCTION
/
TANH   CAL    0              /ENTRY-EXIT
       JMS*   .DA            /GET ARGUMENT
       JMP    TANH02
TANH01 CAL    0              /ADDR OF ARG (X)
TANH02 JMS*   .AG            /LOAD REAL
       .DSA   TANH01+400000  / (ARG)
       LAC*   .AB            /GET SIGN WORD
       DAC    TANH03         /STORE FOR FINAL SIGN
       AND    TANH04         /MAKE POSITIVE
       DAC*   .AB
       ISZ*   .AA            /EXP-EXP+1 (ARG = 2*ARG)
       NOP
       JMS*   .EF            /COMPUTE REAL EXPONENTIAL EXP(2X)
       JMS*   .AI            /ADD REAL
       .DSA   TANH05         / (1)
       JMS*   .AN            /REVERSE DIVIDE REAL
       .DSA   TANH06         / (2/(1+E**2))
       JMS*   .AM            /REVERSE SUBTRACT REAL
       .DSA   TANH05         / (1-(21(1+E**2X)))
       LAC    TANH03         /SIGN WITH ORIGINAL SIGN
       AND    TANH07
       XOR*   .AB
       DAC*   .AB
       JMP*   TANH           /EXIT
TANH03 CAL    0              /ANS SIGN
TANH04        377777
TANH05        1              /FLOATING 1
              200000
TANH06        2              /FLOATING 2
              200000
TANH07        400000
       .END
