MTH$DTAN        ; Double Precision Floating Point Tangent routi  21-AUG-1978 19:05:32   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)      91  HISTORY	; Detailed Current Edit History

   (3)     111  DECLARATIONS	; Declarative Part of Module

   (4)     136  MTH$DTAN  - Standard Double Precision Floating 

MTH$DTAN        ; Double Precision Floating Point Tangent routi  21-AUG-1978 19:05:32   VAX-11 MACRO X0.3-11               Page   1

0-3                                                                                                                              (1)



                                     0000     1 	.TITLE	MTH$DTAN 	; Double Precision Floating Point Tangent routine

                                     0000     2 				; (DTAN)

                                     0000     3 	.IDENT /0-3/		; File: MTHDTAN.MAR

                                     0000     4 ;

                                     0000     5 ; Copyright (C) 1977

                                     0000     6 ; Digital Equipment Corporation, Maynard, Massachusetts 01754

                                     0000     7 ;

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

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

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

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

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

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

                                     0000    14 ; remain in DEC.

                                     0000    15 ;

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

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

                                     0000    18 ; Corporation.

                                     0000    19 ;

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

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

                                     0000    22 ;

                                     0000    23 ;

                                     0000    24 ; FACILITY: MATH LIBRARY

                                     0000    25 ;++

                                     0000    26 ; ABSTRACT:

                                     0000    27 ;

                                     0000    28 ; MTH$DTAN is a function  which  returns the double precision floating point tangent

                                     0000    29 ; of its double precision floating point argument. The call is standard

                                     0000    30 ; call-by-reference.

                                     0000    31 ;

                                     0000    32 ;--

                                     0000    33 ;

                                     0000    34 ; VERSION: 01

                                     0000    35 ;

                                     0000    36 ; HISTORY:

                                     0000    37 ; AUTHOR:

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

                                     0000    39 ;

                                     0000    40 ; MODIFIED BY:

                                     0000    41 ;

                                     0000    42 ;

                                     0000    43 ;

MTH$DTAN        ; Double Precision Floating Point Tangent routi  21-AUG-1978 19:05:32   VAX-11 MACRO X0.3-11               Page   2

0-3             HISTORY ; Detailed Current Edit History                                                                          (2)



                                     0000    45 	.SBTTL	HISTORY	; Detailed Current Edit History

                                     0000    46 

                                     0000    47 

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

                                     0000    49 ;

                                     0000    50 ;	The error return result is undefined operand when DCOS(X) = 0, instead

                                     0000    51 ;	of largest or smallest representable floating number.

                                     0000    52 ;

                                     0000    53 ; Edit History for Version 01 of MTH$DTAN 

                                     0000    54 ;

                                     0000    55 ; 01-2	Error handling mechanism changed. Instead of having 

                                     0000    56 ;	MTH$FLG_JACKET at the entrance, MTH$$ERROR_CONT is stored on the

                                     0000    57 ;	top of the stack frame so when error happened in MTH$DSIN or MTH$DCOS

                                     0000    58 ;	the message will be hided away, but will get signalled in MTH$DTAN.

                                     0000    59 ; 0-3	MTH$$ERROR changed to MTH$$SIGNAL.

                                     0000    60 ;	MTH$$ERROR_CONT changed to MTH$$SIGNAL_CON

                                     0000    61 ;	MTH$_... changed to MTH__....

                                     0000    62 ;	Changed error handling mechanism. Put error result in R0:R1 before

                                     0000    63 ;	calling MTH$$SIGNAL in order to allow user modify error result.

MTH$DTAN        ; Double Precision Floating Point Tangent routi  21-AUG-1978 19:05:32   VAX-11 MACRO X0.3-11               Page   3

0-3             DECLARATIONS ; Declarative Part of Module                                                                        (3)



                                     0000    65 	.SBTTL	DECLARATIONS	; Declarative Part of Module

                                     0000    66 

                                     0000    67 ;

                                     0000    68 ; INCLUDE FILES:	OTSPARAMS.MAR

                                     0000    69 ;

                                     0000    70 ; EXTERNAL SYMBOLS:	MTH$JACKET_HDLR

                                     0000    71 ;

                                     0000    72 ; EQUATED SYMBOLS:	none

                                     0000    73 ;

                                     0000    74 ; MACROS:	none

                                     0000    75 ;

                                     0000    76 

                                     0000    77 	$SRMDEF				; SRM$symbol definitions

                                     0000    78 

                                     0000    79 ;

                                     0000    80 ; PSECT DECLARATIONS:

                                     0000    81 

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

                                     0000    83 					; program section for math routines

                                     0000    84 ;

                                     0000    85 ; OWN STORAGE:	none

                                     0000    86 ;

                                     0000    87 ; CONSDTANTS:

                                     0000    88 

MTH$DTAN        ; Double Precision Floating Point Tangent routi  21-AUG-1978 19:05:32   VAX-11 MACRO X0.3-11               Page   4

0-3             MTH$DTAN  - Standard Double Precision Floating                                                                   (4)



                                     0000    90 	.SBTTL	MTH$DTAN  - Standard Double Precision Floating DTAN

                                     0000    91 

                                     0000    92 

                                     0000    93 ;++

                                     0000    94 ; FUNCTIONAL DESCRIPTION:

                                     0000    95 ;

                                     0000    96 ; DTAN  - double precision floating point function

                                     0000    97 ;

                                     0000    98 ; Algorithmic steps:

                                     0000    99 ;	1) Calculate DSIN

                                     0000   100 ;	   If error from DSIN then return with reserved operand.

                                     0000   101 ;	   If DSIN(X) = 0 then return DTAN(X) = 0.

                                     0000   102 ;	2) Calculate DCOS

                                     0000   103 ;	   (No need to check for reserved operand, should have been

                                     0000   104 ;	   caught in step 1.)

                                     0000   105 ;	   (No need to check for zero, will be caught in step3 as a

                                     0000   106 ;	   hardware trap.)

                                     0000   107 ;	3) Calculate DSIN/DCOS

                                     0000   108 ;	   Hardware trap happens if divided by zero or overflow.

                                     0000   109 ;

                                     0000   110 ; CALLING SEQUENCE:

                                     0000   111 ;

                                     0000   112 ;	DTAN.wd.v = MTH$DTAN(x.rd.r)

                                     0000   113 ;

                                     0000   114 ; INPUT PARAMETERS:

                                     0000   115 

                           00000004  0000   116 	LONG = 4			; define longword multiplier

                           00000004  0000   117 	x = 1 * LONG			; Contents of x is the argument

                                     0000   118 

                                     0000   119 ; IMPLICIT INPUTS:	none

                                     0000   120 ;

                                     0000   121 ; OUTPUT PARAMETERS:

                                     0000   122 ;

                                     0000   123 ;	VALUE:	double precision floating tangent of the argument

                                     0000   124 ;

                                     0000   125 ; IMPLICIT OUTPUTS:	none

                                     0000   126 ;

                                     0000   127 ; COMPLETION CODES:	none

                                     0000   128 ;

                                     0000   129 ; SIDE EFFECTS:

                                     0000   130 ;

                                     0000   131 ; Signal: MTH$_FLOOVEMAT if DCOS(X) = 0 with reserved operand in R0/R1 (copied

                                     0000   132 ; to the signal mechanism vector CHF$L_MCH_R0/R1 by LIB$SIGNAL). Associated

                                     0000   133 ; message is: "FLOATING OVERFLOW IN MATH LIBRARY". Result is reserved operand -0.0

                                     0000   134 ; unless a user supplied (or any) error handler changes CHF$L_MCH_R0/R1.

                                     0000   135 ;

                                     0000   136 ; NOTE: This procedure disables floating point underflow, enables integer

                                     0000   137 ; overflow.

                                     0000   138 ;

                                     0000   139 ;---

                                     0000   140 

                                     0000   141 

                               40FC' 0000   142 	.ENTRY	MTH$DTAN, ^M<IV, R2, R3, R4, R5, R6, R7>

                                     0002   143 					; standard call-by-reference entry

                                     0002   144 					; disable DV (and FU), enable IV

            6D       0000'CF     DE  0002   145 	MOVAL	W^MTH$$SIGNAL_CON, (FP)	; jacket routine in case of error

                                     0007   146 					; call MTH$$SIGNAL_CON in order

MTH$DTAN        ; Double Precision Floating Point Tangent routi  21-AUG-1978 19:05:32   VAX-11 MACRO X0.3-11               Page   5

0-3             MTH$DTAN  - Standard Double Precision Floating                                                                   (4)



                                     0007   147 					; to hide away error message from

                                     0007   148 					; MTH$SIN_R4 or MTH$COS_R4

                                     0007   149 					; If an error, convert signal to user PC

                                     0007   150 					; and resignal

            50         04 BC     70  0007   151 	MOVD	@x(AP), R0		; R0/R1 = argument

                 00000000'EF     16  000B   152 	JSB	MTH$DSIN_R7		; call DSIN(X), R0/R1 = DSIN(X)

                                     0011   153 					; Note: lost of significant can occur 

                                     0011   154 					; if |X| >= 2*PI*2**31. The handler will

                                     0011   155 					; convert the PC to the user's CALL PC

                                     0011   156 					; and resignal

       8000 8F            50     B1  0011   157 	CMPW	R0, #^X8000		; test for reserved operand

                          14     13  0016   158 	BEQL	ERROR_OVF		; branch if reserved operand

            7E            50     70  0018   159 	MOVD	R0, -(SP)		; save DSIN(X) on stack

                          0E     13  001B   160 	BEQL	DTANX			; return 0 if DSIN(X) = 0

            50         04 BC     70  001D   161 	MOVD	@x(AP), R0		; R0/R1 = argument

                 00000000'EF     16  0021   162 	JSB	MTH$DCOS_R7		; call DCOS(X), R0/R1 = DCOS(X)

            8E            50     67  0027   163 	DIVD3	R0, (SP)+, R0		; R0/R1 = DTAN(X) = DSIN(X)/DCOS(X)

                          50         002A       

                                     002B   164 					; Note: divide by 0 can occur!

                                     002B   165 					; The handler will convert the PC to

                                     002B   166 					; the user's call PC and resignal.

                                 04  002B   167 DTANX:	RET				; return, R0/R1 = result

                                     002C   168 

                                     002C   169 

                                     002C   170 ERROR_OVF:

                                     002C   171 					; Note: user PC arg not needed when

                                     002C   172 					; always have a jacket routine

            7E         58 8F     9A  002C   173 	MOVZBL	#MTH__FLOOVEMAT, -(SP)	; condition value

            01            0F     79  0030   174 	ASHQ	#15, #1, R0		; R0/R1 = result = reserved operand -0.0

                          50         0033       

                                     0034   175 					; goes to signal mechanism vector

                                     0034   176 					; (CHF$L_MCH_R0/R1) so error handler

                                     0034   177 					; can modify the result.

       0000'CF            01     FB  0034   178 	CALLS	#1, W^MTH$$SIGNAL	; signal error and use real user's PC

                                     0039   179 					; independent of CALL vs JSB

                                 04  0039   180 10$:	RET				; return - R0/R1 restored from CHF$L_MCH_R0/R1

                                     003A   181 

                                     003A   182 

                                     003A   183 	.END

MTH$DTAN        ; Double Precision Floating Point Tangent routi  21-AUG-1978 19:05:32   VAX-11 MACRO X0.3-11               Page   6

SYMBOL TABLE                                                                                                                     (4)



DTANX            0000002B R     03   

ERROR_OVF        0000002C R     03   

FOR$K_ERR_PREFX= 00000018            

GBL...         = 00000000            

LONG           = 00000004            

MTH$$SIGNAL      ********   X   03   

MTH$$SIGNAL_CON  ********   X   03   

MTH$DCOS_R7      ********   X   03   

MTH$DSIN_R7      ********   X   03   

MTH$DTAN         00000000 RG    03   

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            

SRM$K_DEC_OVF_T= 00000006            

SRM$K_FLT_DIV_T= 00000004            

SRM$K_FLT_OVF_T= 00000003            

SRM$K_FLT_UND_T= 00000005            

SRM$K_INT_DIV_T= 00000002            

SRM$K_INT_OVF_T= 00000001            

SRM$K_SUB_RNG_T= 00000007            

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  

$ABS$            00000000      02     NOPIC   USR   CON   ABS   LCL NOSHR   EXE   RD    WRT BYTE  

MTH$CODE         0000003A      03       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

27068. BYTES LEFT IN FREE MEMORY POOL.

32. BYTES OF RECLAIMED MEMORY.

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

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

