MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)     100  HISTORY	; Detailed Current Edit History

   (3)     100  DECLARATIONS	; Declarative Part of Module

   (4)     100  MTH$DTANH  - Standard DOUBLE Precision Floating

MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   1

01-5                                                                                                                             (1)



                                     0000   100 	.TITLE	MTH$DTANH 	; Floating Point Hyperbolic Tangent routine

                                     0000   200 				; (DTANH)

                                     0000   300 	.IDENT /01-5/		; File: MTHDTANH.MAR

                                     0000   400 ;

                                     0000   500 ; Copyright (C) 1977

                                     0000   600 ; Digital Equipment Corporation, Maynard, Massachusetts 01754

                                     0000   700 ;

                                     0000   800 ; This  software  is furnished under a license for use only on a single

                                     0000   900 ; computer  system  and  may  be  copied only with the inclusion of the

                                     0000  1000 ; above copyright notice.  This software, or  any other copies thereof,

                                     0000  1100 ; may not  be  provided or otherwise made available to any other person

                                     0000  1200 ; except  for  use on such system and to one who agree to these license 

                                     0000  1300 ; terms.  Title  to  and  ownership of the software shall  at all times 

                                     0000  1400 ; remain in DEC.

                                     0000  1500 ;

                                     0000  1600 ; The information  in  the software is subject to change without notice

                                     0000  1700 ; and should  not  be  construed  as  a commitment by Digital Equipment 

                                     0000  1800 ; Corporation.

                                     0000  1900 ;

                                     0000  2000 ; DEC assumes  no  responsibility  for  the use  or  reliability of its

                                     0000  2100 ; software on equipment which is not supplied by DEC.

                                     0000  2200 ;

                                     0000  2300 ;

                                     0000  2400 ; FACILITY: MATH LIBRARY

                                     0000  2500 ;++

                                     0000  2600 ; ABSTRACT:

                                     0000  2700 ;

                                     0000  2800 ; MTH$DTANH is a function  which  returns the floating point hyperbolic tangent

                                     0000  2900 ; of its single precision floating point argument. The call is standard

                                     0000  3000 ; call-by-reference.

                                     0000  3100 ;

                                     0000  3200 ;--

                                     0000  3300 ;

                                     0000  3400 ; VERSION: 01

                                     0000  3500 ;

                                     0000  3600 ; HISTORY:

                                     0000  3700 ; AUTHOR:

                                     0000  3800 ;	Peter Yuo, 29-Jun-77: Version 01

                                     0000  3900 ;

                                     0000  4000 ; MODIFIED BY:

                                     0000  4100 ;

                                     0000  4200 ;

                                     0000  4300 ;

MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   2

01-5            HISTORY ; Detailed Current Edit History                                                                          (2)



                                     0000   100 	.SBTTL	HISTORY	; Detailed Current Edit History

                                     0000   200 

                                     0000   300 

                                     0000   400 ; ALGORITHMIC DIFFERENCES FROM FP-11/C ROUTINE:	none

                                     0000   500 ;

                                     0000   600 ; Edit History for Version 01 of MTH$DTANH 

                                     0000   700 ;

                                     0000   800 ; 0-3	Call MTH$DCOSH, MTH$DSINH directly instead of using POLY.

                                     0000   850 ; 0-4	- Add .EXTRNs.  TNH 13-June-78

                                     0000   875 ; 0-5	- Use W offset on externals.  TNH 13-June-78

                                     0000   900 ;	More accurrate.  TNH 13-June-78

MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   3

01-5            DECLARATIONS ; Declarative Part of Module                                                                        (3)



                                     0000   100 	.SBTTL	DECLARATIONS	; Declarative Part of Module

                                     0000   200 

                                     0000   300 ;

                                     0000   400 ; INCLUDE FILES:	OTSPARAMS.MAR

                                     0000   500 ;

                                     0000   600 ; EXTERNAL SYMBOLS:	MTH$JACKET_HDLR

                                     0000   700 ;

                                     0000   710 	.DSABL	GBL			; Force .EXTRN on all symbols

                                     0000   720 	.EXTRN	MTH$DCOSH		; DCOSH

                                     0000   730 	.EXTRN	MTH$DSINH		; DSINH

                                     0000   765 	.EXTRN	MTH$DEXP_R7		; EXP

                                     0000   800 ; EQUATED SYMBOLS:

                                     0000   900 

                           00004080  0000  1000 	SD_1.0	= ^F1.0			; 1.0

                           00004280  0000  1100 	SD_16.0	= ^F16.0			; 16.0

                           00000004  0000  1200 	value	= 4			; value.rd.r

                                     0000  1300 

                                     0000  1400 ;

                                     0000  1500 ; MACROS:	none

                                     0000  1600 ;

                                     0000  1700 ; PSECT DECLARATIONS:

                                     0000  1800 

                                 00000000  1900 	.PSECT	MTH$CODE	PIC,SHR,LONG,EXE,NOWRT

                                     0000  2000 					; program section for math routines

                                     0000  2100 ;

                                     0000  2200 ; OWN STORAGE:	none

                                     0000  2300 ;

                                     0000  2400 ;

                                     0000  2500 ; CONSTANTS:

                                     0000  2600 ;

                                     0000  2700 

                                     0000  2800 D_0.25:

                0000 0000 0000 3F80  0000  2900 	.WORD	^X3F80, 0, 0, 0		; 0.25

                                     0008  3000 D_2_POWER_M14:

                0000 0000 0000 3980  0008  3100 	.WORD	^X3980, 0, 0, 0		; 2**-14

                                     0010  3200 

MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   4

01-5            MTH$DTANH  - Standard DOUBLE Precision Floating                                                                  (4)



                                     0010   100 	.SBTTL	MTH$DTANH  - Standard DOUBLE Precision Floating DTANH

                                     0010   200 

                                     0010   300 

                                     0010   400 ;++

                                     0010   500 ; FUNCTIONAL DESCRIPTION:

                                     0010   600 ;

                                     0010   700 ; DTANH  - double precision floating point function

                                     0010   800 ;

                                     0010   900 ; DTANH(X) is computed as:

                                     0010  1000 ;

                                     0010  1100 ;	If |X| =< 2**-14, then DTANH(X) = X.

                                     0010  1200 ;	If 2**-14 < |X| =< 0.25, then DTANH(X) = DSINH(X)/DCOSH(X).

                                     0010  1300 ;	If 0.25 < |X| < 16.0, then DTANH(X) = (DEXP(2*X) - 1) / (DEXP(2*X) + 1)

                                     0010  1400 ;	If 16.0 =< |X|, then DTANH(X) = sign(X) * 1

                                     0010  1500 ;

                                     0010  1600 ; CALLING SEQUENCE:

                                     0010  1700 ;

                                     0010  1800 ;	DTANH.wd.v = MTH$DTANH(x.rd.r)

                                     0010  1900 ;

                                     0010  2000 ; INPUT PARAMETERS:

                                     0010  2100 

                           00000004  0010  2200 	LONG = 4			; define longword multiplier

                           00000004  0010  2300 	x = 1 * LONG			; Contents of x is the argument

                                     0010  2400 

                                     0010  2500 ; IMPLICIT INPUTS:	none

                                     0010  2600 ;

                                     0010  2700 ; OUTPUT PARAMETERS:

                                     0010  2800 ;

                                     0010  2900 ;	VALUE:	double precision floating hyperbolic tangent of the argument

                                     0010  3000 ;

                                     0010  3100 ; IMPLICIT OUTPUTS:	none

                                     0010  3200 ;

                                     0010  3300 ; COMPLETION CODES:	none

                                     0010  3400 ;

                                     0010  3500 ; SIDE EFFECTS:	none

                                     0010  3600 ;

                                     0010  3700 ; NOTE: This procedure disables floating point underflow, enables integer

                                     0010  3800 ; overflow.

                                     0010  3900 ;

                                     0010  4000 ;---

                                     0010  4100 

                                     0010  4200 

                               40FC' 0010  4300 	.ENTRY	MTH$DTANH, ^M<IV, R2, R3, R4, R5, R6, R7>

                                     0012  4400 					; standard call-by-reference entry

                                     0012  4500 					; disable DV (and FU), enable IV

                                     0012  4600 	MTH$FLAG_JACKET			; flag that this is a jacket procedure in

                                     0012      

            6D       0000'CF     3E  0012       	MOVAW	W^MTH$$JACKET_HND, (FP)

                                     0017       					; set handler address to jacket

                                     0017       					; handler

                                     0017       

                                     0017  4700 					; case of an error in routine

                                     0017  4800 					; If an error, convert signal to user PC

                                     0017  4900 					; and resignal

            50         04 BC     70  0017  5000 	MOVD	@value(AP), R0		; R0/R1 = |X| = @value(AP)

            50       8000 8F     AA  001B  5100 	BICW	#^X8000, R0		; R0/R1 = |X|

         E4 AF            50     71  0020  5200 	CMPD	R0, D_2_POWER_M14	; compare |X| with 2**-14

MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   5

01-5            MTH$DTANH  - Standard DOUBLE Precision Floating                                                                  (4)



                          3D     15  0024  5300 	BLEQ	OUT_X			; branch if |X| =< 2**-14

                                     0026  5400 

                                     0026  5500 ;

                                     0026  5600 ; 2**-14 < |X|

                                     0026  5700 ;

                                     0026  5800 

            28            50     71  0026  5900 	CMPD	R0, S^#SD_16.0		; compare |X| with 16.0

                          2C     18  0029  6000 	BGEQ	GEQ_TO_16.0		; branch if |X| >= 16.0

                                     002B  6100 

                                     002B  6200 ;

                                     002B  6300 ; 2**-14 < |X| < 16.0

                                     002B  6400 ;

                                     002B  6500 

         D1 AF            50     71  002B  6600 	CMPD	R0, D_0.25		; compare |X| with 0.25

                          15     15  002F  6700 	BLEQ	LEQ_TO_0.25		; branch if |X| =< 0.25

                                     0031  6800 

                                     0031  6900 ;

                                     0031  7000 ; 0.25 < |X| < 16.0

                                     0031  7100 ;

                                     0031  7200 

         04 BC         04 BC     61  0031  7300 	ADDD3	@value(AP), @value(AP), R0

                          50         0036       

                                     0037  7400 					; R0/R1 = 2*X

                     0000'CF     16  0037  7500 	JSB	W^MTH$DEXP_R7		; R0/R1 = DEXP(2*X)

            50            08     61  003B  7600 	ADDD3	S^#SD_1.0, R0, R2	; R2/R3 = DEXP(2*X) + 1

                          52         003E       

            50            08     62  003F  7700 	SUBD	S^#SD_1.0, R0		; R0/R1 = DEXP(2*X) - 1

            50            52     66  0042  7800 	DIVD	R2, R0			; R0/R1 = (DEXP(2*X) - 1) / (DEXP(2*X) + 1)

                                 04  0045  7900 	RET				; return with result in R0/R1

                                     0046  8000 

                                     0046  8100 ;

                                     0046  8200 ; 2**-1R6 < |X| =< 0.25

                                     0046  8300 ;

                                     0046  8400 

                                     0046  8500 LEQ_TO_0.25:

       0000'CF            6C     FA  0046  8600 	CALLG	(AP), W^MTH$DCOSH		; R0/R1 = DCOSH(X)

            52            50     70  004B  8800 	MOVD	R0, R2			; R2/R3 = DCOSH(X)

       0000'CF            6C     FA  004E  8900 	CALLG	(AP), W^MTH$DSINH		; R0/R1 = DSINH(X)

            50            52     66  0053  9100 	DIVD	R2, R0			; R0/R1 = DSINH(X) / DCOSH(X)

                                 04  0056  9200 	RET				; return with result in R0

                                     0057  9300 

                                     0057  9400 ;

                                     0057  9500 ; |X| >= 16.0

                                     0057  9600 ;

                                     0057  9700 

                                     0057  9800 GEQ_TO_16.0:

            50            08     70  0057  9900 	MOVD	S^#SD_1.0, R0		; R0/R1 = 1.0

                       04 BC     73  005A 10000 	TSTD	@value(AP)		; test the sign of X

                          03     18  005D 10100 	BGEQ	10$			; branch if X >= 0

            50            50     72  005F 10200 	MNEGD	R0, R0			; R0/R1 = -1

                                 04  0062 10300 10$:	RET				; return with result in R0

                                     0063 10400 

                                     0063 10500 ;

                                     0063 10600 ; |X| =< 2**-14

                                     0063 10700 ;

                                     0063 10800 

            50         04 BC     70  0063 10900 OUT_X:	MOVD	@value(AP), R0		; R0/R1 = DTANH(X) = X

MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   6

01-5            MTH$DTANH  - Standard DOUBLE Precision Floating                                                                  (4)



                                 04  0067 11000 	RET				; return with result in R0/R1

                                     0068 11100 

                                     0068 11200 

                                     0068 11300 

                                     0068 11400 	.END

MTH$DTANH       ; Floating Point Hyperbolic Tangent routine      21-AUG-1978 19:05:41   VAX-11 MACRO X0.3-11               Page   7

SYMBOL TABLE                                                                                                                     (4)



D_0.25           00000000 R     02   

D_2_POWER_M14    00000008 R     02   

FOR$K_ERR_PREFX= 00000018            

GEQ_TO_16.0      00000057 R     02   

LEQ_TO_0.25      00000046 R     02   

LONG           = 00000004            

MTH$$JACKET_HND  ********   X   02   

MTH$DCOSH        ********   X   01   

MTH$DEXP_R7      ********   X   01   

MTH$DSINH        ********   X   01   

MTH$DTANH        00000010 RG    02   

MTH$K_ERR_PREFX= 00000016            

MTH__FLOOVEMAT = 00000058            

MTH__FLOUNDMAT = 00000059            

MTH__INVARG    = 00000051            

MTH__LOGZERNEG = 00000053            

MTH__SINSIGLOS = 00000057            

MTH__SQUROONEG = 00000054            

MTH__UNDEXP    = 00000052            

MTH__WRONUMARG = 00000050            

OUT_X            00000063 R     02   

SD_1.0         = 00004080            

SD_16.0        = 00004280            

VALUE          = 00000004            

X              = 00000004            





PROGRAM SECTION SYNOPSIS



.  ABS  .        00000000      00     NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT BYTE  

. BLANK .        00000000      01     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT BYTE  

MTH$CODE         00000068      02       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

27782. BYTES LEFT IN FREE MEMORY POOL.

OBJ$:MTHDTANH,LIS$:MTHDTANH/-SP=LIB$:S/ML,SRC$:P,MTHDTANH

0 MLB DIR RDS - 0 GETS TO DEFINE 0 MACROS. 2 INTER. FILE WRITES. 

