       .TITLE TANH   HYPERBOLIC TANGENT FOR REAL ARGUMENT
/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
/ CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
/ AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
/ A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
/ INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
/ USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/COPYRIGHT 1970,1971, DIGITAL EQUIPMENT CORP., MAYNARD, MASS. 01754
/FOR HARDWARE FLOATING POINT PROCESSOR (FPP), DEFINE 90 FPP,
/EDIT 4   2-26-71
       .GLOBL TANH,.DA,.EF
	.IFUND %FPP
	.GLOBL .AG,.AA,.AB,.AI
	.GLOBL .AN,.AM
	.ENDC
	.IFUND %FPP
	.DEFIN FLD%,A		/FLOATING LOAD (.AG)
	JMS* A
	.ENDM
	.ENDC
	.IFDEF %FPP
FLD=713050
	.DEFIN FLD%
	FLD
	.ENDM
	.ENDC
	.IFUND %FPP
	.DEFIN FAD%,A		/FLOATING ADD (.AI)
	JMS* A
	.ENDM
	.ENDC
	.IFDEF %FPP
FAD=716040
	.DEFIN FAD%
	FAD
	.ENDM
	.ENDC
	.IFUND %FPP
	.DEFIN FRD%,A		/FLOATING REVERSE DIVIDE
	JMS* A			/(.AN)
	.ENDM
	.ENDC
	.IFDEF %FPP
FRD=712440
	.DEFIN FRD%
	FRD
	.ENDM
	.ENDC
	.IFUND %FPP
	.DEFIN FRS%,A		/FLOATING REVERSE SUBTRACT
	JMS* A			/(.AM)
	.ENDM
	.ENDC
	.IFDEF %FPP
FRS=711040
	.DEFIN FRS%
	FRS
	.ENDM
	.ENDC
	.IFUND %FPP
	.DEFIN GETHOM
	LAC* .AB
	.ENDM
	.ENDC
	.IFDEF %FPP
	.GLOBL .ZA
	.DEFIN GETHOM
	JMS* .ZA
	.ENDM
	.ENDC
/             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
/FPP INSTR ASS.
	.IFDEF %FPP
FAB=713271		/MAKE FPP AC POS.
FNG=713272		/MAKE FPP AC NEG.
FMP=711440		/FLT. MULTIPLY
	.ENDC
/
TANH   CAL    0              /ENTRY-EXIT
       JMS*   .DA            /GET ARGUMENT
       JMP    TANH02
TANH01 CAL    0              /ADDR OF ARG (X)
TANH02 FLD%   .AG            /LOAD REAL
       .DSA   TANH01+400000  / (ARG)
       GETHOM             /GET SIGN WORD
       DAC    TANH03         /STORE FOR FINAL SIGN
	.IFDEF %FPP
	FAB
	0
	.ENDC
	.IFUND %FPP
       AND    TANH04         /MAKE POSITIVE
       DAC*   .AB
	.ENDC
	.IFDEF %FPP
	FMP		/MP BY 2
	TANH06
	.ENDC
	.IFUND %FPP
       ISZ*   .AA            /EXP-EXP+1 (ARG = 2*ARG)
       NOP
	.ENDC
       JMS*   .EF            /COMPUTE REAL EXPONENTIAL EXP(2X)
       FAD%   .AI            /ADD REAL
       .DSA   TANH05         / (1)
       FRD%   .AN            /REVERSE DIVIDE REAL
       .DSA   TANH06         / (2/(1+E**2))
       FRS%   .AM            /REVERSE SUBTRACT REAL
       .DSA   TANH05         / (1-(21(1+E**2X)))
       LAC    TANH03         /SIGN WITH ORIGINAL SIGN
	.IFDEF %FPP
	SPA
	JMP TANH08
	FAB
	0
	JMP* TANH
TANH08	FNG
	0
	JMP* TANH
	.ENDC
	.IFUND %FPP
       AND    TANH07
       XOR*   .AB
       DAC*   .AB
	.ENDC
       JMP*   TANH           /EXIT
TANH03 CAL    0              /ANS SIGN
	.IFUND %FPP
TANH04        377777
	.ENDC
TANH05        1              /FLOATING 1
              200000
TANH06        2              /FLOATING 2
              200000
TANH07        400000
       .END
