MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)      91  HISTORY	; Detailed Current Edit History

   (3)     104  DECLARATIONS	; Declarative Part of Module

   (4)     137  MTH$DACOS  - Standard Double Precision Floating

   (5)     198  MTH$DACOS_R9 - Special DACOS routine

MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   1

0-4                                                                                                                              (1)



                                     0000     1 	.TITLE	MTH$DACOS 	; Double Precision Floating Point Arc-cosine routine

                                     0000     2 				; (DACOS)

                                     0000     3 	.IDENT /0-4/		; File: MTHDACOS.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$DACOS is a function which returns the double precision floating point

                                     0000    29 ; arc-cosine of its double precision floating point argument. The call is

                                     0000    30 ; standard 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$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   2

0-4             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 ; Edit History for Version 01 of MTH$DACOS 

                                     0000    51 ;

                                     0000    52 ; 0-2	MTH$$ERROR changed to MTH$$SIGNAL.

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

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

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

                                     0000    56 ; 0-3	- Changed MOVD #0, to CLRD.  TNH 10-Nov-77

MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   3

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



                                     0000    58 	.SBTTL	DECLARATIONS	; Declarative Part of Module

                                     0000    59 

                                     0000    60 ;

                                     0000    61 ; INCLUDE FILES:	OTSPARAMS.MAR

                                     0000    62 ;

                                     0000    63 ; EXTERNAL SYMBOLS:	MTH$JACKET_HDLR

                                     0000    64 ;

                                     0000    65 ; EQUATED SYMBOLS:

                                     0000    66 

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

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

                                     0000    69 

                                     0000    70 ;

                                     0000    71 ; MACROS:	none

                                     0000    72 ;

                                     0000    73 ; PSECT DECLARATIONS:

                                     0000    74 

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

                                     0000    76 					; program section for math routines

                                     0000    77 ;

                                     0000    78 ; OWN STORAGE:	none

                                     0000    79 ;

                                     0000    80 ;

                                     0000    81 ; CONSTANTS:

                                     0000    82 ;

                                     0000    83 

                                     0000    84 D_PI_OVER_2:

                68C2 A221 0FDA 40C9  0000    85 	.WORD	^O040311, ^O007732, ^O121041, ^O064302

                                     0008    86 					; PI/2

                                     0008    87 D_PI:

                68C2 A221 0FDA 4149  0008    88 	.WORD	^O040511, ^O007732, ^O121041, ^O064302

                                     0010    89 					; PI

MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   4

0-4             MTH$DACOS  - Standard Double Precision Floating                                                                  (4)



                                     0010    91 	.SBTTL	MTH$DACOS  - Standard Double Precision Floating DACOS

                                     0010    92 

                                     0010    93 

                                     0010    94 ;++

                                     0010    95 ; FUNCTIONAL DESCRIPTION:

                                     0010    96 ;

                                     0010    97 ; DACOS  - double precision floating point function

                                     0010    98 ;

                                     0010    99 ; DACOS(X) is computed as:

                                     0010   100 ;

                                     0010   101 ;	If X = 0, then DACOS(X) = PI/2.

                                     0010   102 ;	If X = 1, then DACOS(X) = 0.

                                     0010   103 ;	If X = -1, then DACOS(X) = PI.

                                     0010   104 ;	If 0 < X < 1, then DACOS(X) = ATAN(SQRT(1-X**2)/X).

                                     0010   105 ;	IF -1 < X < 0, then DACOS(X) = ATAN(SQRT(1-X**2)/X) + PI.

                                     0010   106 ;	If 1 < |X|, error.

                                     0010   107 ;

                                     0010   108 ; CALLING SEQUENCE:

                                     0010   109 ;

                                     0010   110 ;	DACOS.wd.v = MTH$DACOS(x.rd.r)

                                     0010   111 ;

                                     0010   112 ; INPUT PARAMETERS:

                                     0010   113 

                           00000004  0010   114 	LONG = 4			; define longword multiplier

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

                                     0010   116 

                                     0010   117 ; IMPLICIT INPUTS:	none

                                     0010   118 ;

                                     0010   119 ; OUTPUT PARAMETERS:

                                     0010   120 ;

                                     0010   121 ;	VALUE:	double precision floating arc-cosine of the argument

                                     0010   122 ;

                                     0010   123 ; IMPLICIT OUTPUTS:	none

                                     0010   124 ;

                                     0010   125 ; COMPLETION CODES:	none

                                     0010   126 ;

                                     0010   127 ; SIDE EFFECTS:

                                     0010   128 ;

                                     0010   129 ; Signals: MTH$_INVARG if |X| > 1 with reserved operand in R0/R1 (copied

                                     0010   130 ; to the signal mechanism vector CHF$L_MCH_R0/R1 by LIB$SIGNAL).

                                     0010   131 ; Associated message is: "INVALID ARGUMENT". Result is reserved operand -0.0

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

                                     0010   133 ;

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

                                     0010   135 ; overflow.

                                     0010   136 ;

                                     0010   137 ;---

                                     0010   138 

                                     0010   139 

                               43FC' 0010   140 	.ENTRY	MTH$DACOS, ^M<IV, R2, R3, R4, R5, R6, R7, R8, R9>

                                     0012   141 					; standard call-by-reference entry

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

                                     0012   143 	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

MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   5

0-4             MTH$DACOS  - Standard Double Precision Floating                                                                  (4)



                                     0017       

                                     0017   144 					; case of an error in routine

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

                                     0017   146 					; and resignal

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

                          01     10  001B   148 	BSBB	MTH$DACOS_R9		; call special DACOS routine

                                 04  001D   149 	RET				; return with result in R0/R1

                                     001E   150 

MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   6

0-4             MTH$DACOS_R9 - Special DACOS routine                                                                             (5)



                                     001E   152 	.SBTTL	MTH$DACOS_R9 - Special DACOS routine

                                     001E   153 

                                     001E   154 ; Special DACOS - used by the stnadard routine and direct JSB call.

                                     001E   155 ;

                                     001E   156 ; CALLING SEQUENCE:

                                     001E   157 ;	save anything needed in R0:R9

                                     001E   158 ;	MOVD	..., R0			; input in R0/R1

                                     001E   159 ;	JSB	MTH$DACOS_R9

                                     001E   160 ;	RSB				; return with result in R0/R1

                                     001E   161 ;

                                     001E   162 

                                     001E   163 MTH$DACOS_R9::				; special DACOS routine

            58            50     70  001E   164 	MOVD	R0, R8			; save X in R8/R9

            50       8000 8F     AA  0021   165 	BICW	#^X8000, R0		; R0/R1 = |X|

                          50     73  0026   166 	TSTD	R0			; test if |X| > 0

                          05     14  0028   167 	BGTR	TEST_FOR_1.0		; branch if |X| > 0

                                     002A   168 

                                     002A   169 ;

                                     002A   170 ; X = 0

                                     002A   171 ;

                                     002A   172 

            50         D3 AF     70  002A   173 	MOVD	D_PI_OVER_2, R0		; R0/R1 = PI/2

                                 05  002E   174 	RSB				; return PI/2 if |X| = 0

                                     002F   175 

                                     002F   176 ;

                                     002F   177 ; 0 < |X|

                                     002F   178 ;

                                     002F   179 

                                     002F   180 TEST_FOR_1.0:

            08            50     71  002F   181 	CMPD	R0, S^#SD_1.0		; compare |X| with 1.0

                          19     18  0032   182 	BGEQ	GEQ_TO_1.0		; branch if |X| >= 1.0

                                     0034   183 

                                     0034   184 ;

                                     0034   185 ; 0 < |X| < 1.0

                                     0034   186 ;

                                     0034   187 

            58            58     65  0034   188 	MULD3	R8, R8, R0		; R0/R1 = X**2

                          50         0037       

            08            50     63  0038   189 	SUBD3	R0, S^#SD_1.0, R0	; R0/R1 = 1.0 - X**2

                          50         003B       

                 00000000'EF     16  003C   190 	JSB	MTH$DSQRT_R5		; R0/R1 = DSQRT(1-X**2)

            50            58     66  0042   191 	DIVD	R8, R0			; R0/R1 = DSQRT(1-X**2)/X

                 00000000'EF     16  0045   192 	JSB	MTH$DATAN_R7		; R0/R1 = DATAN(DSQRT(1-X**2)/X)

                          04     11  004B   193 	BRB	TEST_SIGN		; branch to TEST_SIGN

                                     004D   194 

                                     004D   195 ;

                                     004D   196 ; 1 =< |X| 

                                     004D   197 ;

                                     004D   198 

                                     004D   199 GEQ_TO_1.0:

                          0B     14  004D   200 	BGTR	ERROR			; branch to ERROR if |X| > 1.0

                                     004F   201 

                                     004F   202 

                                     004F   203 ;

                                     004F   204 ; |X| = 1.0

                                     004F   205 ;

                                     004F   206 

MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   7

0-4             MTH$DACOS_R9 - Special DACOS routine                                                                             (5)



                          50     7C  004F   207 	CLRD	R0			; R0/R1 = 0

                                     0051   208 

                                     0051   209 

                                     0051   210 ;

                                     0051   211 ; Test the sign of X in order to decide if add PI to the result

                                     0051   212 ;

                                     0051   213 

                                     0051   214 TEST_SIGN:

                          58     73  0051   215 	TSTD	R8			; test the sign of X

                          04     18  0053   216 	BGEQ	10$			; branch if X > 0

            50         B0 AF     60  0055   217 	ADDD	D_PI, R0		; add PI to R0/R1 if X < 0

                                 05  0059   218 10$:	RSB				; return with result in R0/R1

                                     005A   219 

                                     005A   220 ;

                                     005A   221 ; 1 < |X|, error

                                     005A   222 ;

                                     005A   223 

                          6E     DD  005A   224 ERROR:	PUSHL	(SP)			; return PC from JSB routine

            7E         51 8F     9A  005C   225 	MOVZBL	#MTH__INVARG, -(SP)	; condition value

            01            0F     79  0060   226 	ASHQ	#15, #1, R0		; R0 = result = reserved operand -0.0

                          50         0063       

                                     0064   227 					; goes to signal mechanism vector

                                     0064   228 					; (CHF$L_MCH_R0/R1) so error handler

                                     0064   229 					; can modify the result.

       0000'CF            02     FB  0064   230 	CALLS	#2, W^MTH$$SIGNAL	; signal error and use real user's PC

                                     0069   231 					; independent of CALL vs JSB

                                 05  0069   232 	RSB				; return - R0 restored from CHF$L_MCH_R0/R1

                                     006A   233 

                                     006A   234 

                                     006A   235 

                                     006A   236 

                                     006A   237 	.END

MTH$DACOS       ; Double Precision Floating Point Arc-cosine ro  21-AUG-1978 19:03:15   VAX-11 MACRO X0.3-11               Page   8

SYMBOL TABLE                                                                                                                     (5)



D_PI             00000008 R     02   

D_PI_OVER_2      00000000 R     02   

ERROR            0000005A R     02   

FOR$K_ERR_PREFX= 00000018            

GEQ_TO_1.0       0000004D R     02   

LONG           = 00000004            

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

MTH$$SIGNAL      ********   X   02   

MTH$DACOS        00000010 RG    02   

MTH$DACOS_R9     0000001E RG    02   

MTH$DATAN_R7     ********   X   02   

MTH$DSQRT_R5     ********   X   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            

SD_1.0         = 00004080            

TEST_FOR_1.0     0000002F R     02   

TEST_SIGN        00000051 R     02   

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         0000006A      02       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

27762. BYTES LEFT IN FREE MEMORY POOL.

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

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

