MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   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)     135  MTH$ACOS  - Standard Single Precision Floating 

   (5)     196  MTH$ACOS_R5 - Special ACOS routine

MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   1

01-5                                                                                                                             (1)



                                     0000     1 	.TITLE	MTH$ACOS 	; Floating Point Arc-cosine routine

                                     0000     2 				; (ACOS)

                                     0000     3 	.IDENT /01-5/		; File: MTHACOS.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$ACOS is a function  which  returns the floating point arc-cosine

                                     0000    29 ; of its single 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$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   2

01-5            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$ACOS 

                                     0000    51 ;

                                     0000    52 ; 01-2	Changed MOVF #0, R0 into CLRL R0.

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

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

                                     0000    55 ;	Changed error handling mechanism. Put error result in R0 (or R0:R1)

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

MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   3

01-5            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 	SF_1.0	= ^F1.0			; 1.0

                           0FDB40C9  0000    68 	LF_PI_OV_2	= ^O007733@16 + ^O040311

                                     0000    69 					; PI/2

                           0FDB4149  0000    70 	LF_PI		= ^O007733@16 + ^O040511

                                     0000    71 					; PI

                           00000004  0000    72 	value	= 4			; value.rf.r

                                     0000    73 

                                     0000    74 ;

                                     0000    75 ; MACROS:	none

                                     0000    76 ;

                                     0000    77 ; PSECT DECLARATIONS:

                                     0000    78 

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

                                     0000    80 					; program section for math routines

                                     0000    81 ;

                                     0000    82 ; OWN STORAGE:	none

                                     0000    83 ;

                                     0000    84 ;

                                     0000    85 ; CONSTANTS:

                                     0000    86 ;

                                     0000    87 

MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   4

01-5            MTH$ACOS  - Standard Single Precision Floating                                                                   (4)



                                     0000    89 	.SBTTL	MTH$ACOS  - Standard Single Precision Floating ACOS

                                     0000    90 

                                     0000    91 

                                     0000    92 ;++

                                     0000    93 ; FUNCTIONAL DESCRIPTION:

                                     0000    94 ;

                                     0000    95 ; ACOS  - single precision floating point function

                                     0000    96 ;

                                     0000    97 ; ACOS(X) is computed as:

                                     0000    98 ;

                                     0000    99 ;	If X = 0, then ACOS(X) = PI/2.

                                     0000   100 ;	If X = 1, then ACOS(X) = 0.

                                     0000   101 ;	If X = -1, then ACOS(X) = PI.

                                     0000   102 ;	If 0 < X < 1, then ACOS(X) = ATAN(SQRT(1-X**2)/X).

                                     0000   103 ;	IF -1 < X < 0, then ACOS(X) = ATAN(SQRT(1-X**2)/X) + PI.

                                     0000   104 ;	If 1 < |X|, error.

                                     0000   105 ;

                                     0000   106 ; CALLING SEQUENCE:

                                     0000   107 ;

                                     0000   108 ;	ACOS.wf.v = MTH$ACOS(x.rf.r)

                                     0000   109 ;

                                     0000   110 ; INPUT PARAMETERS:

                                     0000   111 

                           00000004  0000   112 	LONG = 4			; define longword multiplier

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

                                     0000   114 

                                     0000   115 ; IMPLICIT INPUTS:	none

                                     0000   116 ;

                                     0000   117 ; OUTPUT PARAMETERS:

                                     0000   118 ;

                                     0000   119 ;	VALUE:	floating arc-cosine of the argument

                                     0000   120 ;

                                     0000   121 ; IMPLICIT OUTPUTS:	none

                                     0000   122 ;

                                     0000   123 ; COMPLETION CODES:	none

                                     0000   124 ;

                                     0000   125 ; SIDE EFFECTS:

                                     0000   126 ;

                                     0000   127 ; Signals: MTH$_INVARG if |X| > 1 with reserved operand in R0 (copied to

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

                                     0000   129 ; Associated message is: "INVALID ARGUMENT". Result is reserved operand -0.0

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

                                     0000   131 ;

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

                                     0000   133 ; overflow.

                                     0000   134 ;

                                     0000   135 ;---

                                     0000   136 

                                     0000   137 

                               403C' 0000   138 	.ENTRY	MTH$ACOS, ^M<IV, R2, R3, R4, R5>

                                     0002   139 					; standard call-by-reference entry

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

                                     0002   141 	MTH$FLAG_JACKET			; flag that this is a jacket procedure in

                                     0002      

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

                                     0007       					; set handler address to jacket

                                     0007       					; handler

MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   5

01-5            MTH$ACOS  - Standard Single Precision Floating                                                                   (4)



                                     0007       

                                     0007   142 					; case of an error in routine

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

                                     0007   144 					; and resignal

            50         04 BC     50  0007   145 	MOVF	@value(AP), R0		; R0 = |X| = @value(AP)

                          01     10  000B   146 	BSBB	MTH$ACOS_R5		; call special ACOS routine

                                 04  000D   147 	RET				; return with result in R0

                                     000E   148 

MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   6

01-5            MTH$ACOS_R5 - Special ACOS routine                                                                               (5)



                                     000E   150 	.SBTTL	MTH$ACOS_R5 - Special ACOS routine

                                     000E   151 

                                     000E   152 ; Special ACOS - used by the stnadard routine, direct JSB call.

                                     000E   153 ;

                                     000E   154 ; CALLING SEQUENCE:

                                     000E   155 ;	save anything needed in R0:R5

                                     000E   156 ;	MOVF	..., R0			; input in R0

                                     000E   157 ;	JSB	MTH$ACOS_R5

                                     000E   158 ;	RSB				; return with result in R0

                                     000E   159 ;

                                     000E   160 

                                     000E   161 MTH$ACOS_R5::				; special ACOS routine

            55            50     50  000E   162 	MOVF	R0, R5			; save X in R5

            50       8000 8F     AA  0011   163 	BICW	#^X8000, R0		; R0 = |X|

                          50     53  0016   164 	TSTF	R0			; test if |X| > 0

                          08     14  0018   165 	BGTR	TEST_FOR_1.0		; branch if |X| > 0

                                     001A   166 

                                     001A   167 ;

                                     001A   168 ; X = 0

                                     001A   169 ;

                                     001A   170 

            50   0FDB40C9 8F     50  001A   171 	MOVF	#LF_PI_OV_2, R0		; R0 = PI/2

                                 05  0021   172 	RSB				; return PI/2 if |X| = 0

                                     0022   173 

                                     0022   174 ;

                                     0022   175 ; 0 < |X|

                                     0022   176 ;

                                     0022   177 

                                     0022   178 TEST_FOR_1.0:

            08            50     51  0022   179 	CMPF	R0, S^#SF_1.0		; compare |X| with 1.0

                          19     18  0025   180 	BGEQ	GEQ_TO_1.0		; branch if |X| >= 1.0

                                     0027   181 

                                     0027   182 ;

                                     0027   183 ; 0 < |X| < 1.0

                                     0027   184 ;

                                     0027   185 

            55            55     45  0027   186 	MULF3	R5, R5, R0		; R0 = X**2

                          50         002A       

            08            50     43  002B   187 	SUBF3	R0, S^#SF_1.0, R0	; R0 = 1.0 - X**2

                          50         002E       

                 00000000'EF     16  002F   188 	JSB	MTH$SQRT_R2		; R0 = SQRT(1-X**2)

            50            55     46  0035   189 	DIVF	R5, R0			; R0 = SQRT(1-X**2)/X

                 00000000'EF     16  0038   190 	JSB	MTH$ATAN_R4		; R0 = ATAN(SQRT(1-X**2)/X)

                          04     11  003E   191 	BRB	TEST_SIGN		; branch to TEST_SIGN

                                     0040   192 

                                     0040   193 ;

                                     0040   194 ; 1 =< |X| 

                                     0040   195 ;

                                     0040   196 

                                     0040   197 GEQ_TO_1.0:

                          0E     14  0040   198 	BGTR	ERROR			; branch to ERROR if |X| > 1.0

                                     0042   199 

                                     0042   200 

                                     0042   201 ;

                                     0042   202 ; |X| = 1.0

                                     0042   203 ;

                                     0042   204 

MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   7

01-5            MTH$ACOS_R5 - Special ACOS routine                                                                               (5)



                          50     D4  0042   205 	CLRF	R0			; R0 = 0

                                     0044   206 

                                     0044   207 

                                     0044   208 ;

                                     0044   209 ; Test the sign of X in order to decide if add PI to the result

                                     0044   210 ;

                                     0044   211 

                                     0044   212 TEST_SIGN:

                          55     53  0044   213 	TSTF	R5			; test the sign of X

                          07     18  0046   214 	BGEQ	10$			; branch if X > 0

            50   0FDB4149 8F     40  0048   215 	ADDF	#LF_PI, R0		; add PI to R0 if X < 0

                                 05  004F   216 10$:	RSB				; return with result in R0

                                     0050   217 

                                     0050   218 ;

                                     0050   219 ; 1 < |X|, error

                                     0050   220 ;

                                     0050   221 

                          6E     DD  0050   222 ERROR:	PUSHL	(SP)			; return PC from JSB routine

            7E         51 8F     9A  0052   223 	MOVZBL	#MTH__INVARG, -(SP)	; condition value

            01            0F     78  0056   224 	ASHL	#15, #1, R0		; R0 = result = reserved operand -0.0

                          50         0059       

                                     005A   225 					; goes to signal mechanism vector

                                     005A   226 					; (CHF$L_MCH_R0/R1) so error handler

                                     005A   227 					; can modify the result.

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

                                     005F   229 					; independent of CALL vs JSB

                                 05  005F   230 	RSB				; return - R0 restored from CHF$L_MCH_R0/R1

                                     0060   231 

                                     0060   232 

                                     0060   233 

                                     0060   234 

                                     0060   235 	.END

MTH$ACOS        ; Floating Point Arc-cosine routine              21-AUG-1978 19:01:20   VAX-11 MACRO X0.3-11               Page   8

SYMBOL TABLE                                                                                                                     (5)



ERROR            00000050 R     02   

FOR$K_ERR_PREFX= 00000018            

GEQ_TO_1.0       00000040 R     02   

LF_PI          = 0FDB4149            

LF_PI_OV_2     = 0FDB40C9            

LONG           = 00000004            

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

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

MTH$ACOS         00000000 RG    02   

MTH$ACOS_R5      0000000E RG    02   

MTH$ATAN_R4      ********   X   02   

MTH$K_ERR_PREFX= 00000016            

MTH$SQRT_R2      ********   X   02   

MTH__FLOOVEMAT = 00000058            

MTH__FLOUNDMAT = 00000059            

MTH__INVARG    = 00000051            

MTH__LOGZERNEG = 00000053            

MTH__SINSIGLOS = 00000057            

MTH__SQUROONEG = 00000054            

MTH__UNDEXP    = 00000052            

MTH__WRONUMARG = 00000050            

SF_1.0         = 00004080            

TEST_FOR_1.0     00000022 R     02   

TEST_SIGN        00000044 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         00000060      02       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

27764. BYTES LEFT IN FREE MEMORY POOL.

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

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

