OTS$POWRR       - REAL ** REAL power routine                     21-AUG-1978 19:10:25   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)     100  HISTORY		; Detailed current edit history

   (3)     100  DECLARATIONS

   (4)     100  OTS$POWRR - REAL to REAL giving REAL result

OTS$POWRR       - REAL ** REAL power routine                     21-AUG-1978 19:10:25   VAX-11 MACRO X0.3-11               Page   1

0-7                                                                                                                              (1)



                                     0000   100 	.TITLE	OTS$POWRR - REAL ** REAL power routine

                                     0000   200 	.IDENT	/0-7/		; File: OTSPOWRR.MAR

                                     0000   300 

                                     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: Language support library - user callable

                                     0000  2500 ;++

                                     0000  2600 ; ABSTRACT:

                                     0000  2700 ;

                                     0000  2800 ;	REAL base to REAL power.

                                     0000  2900 ;

                                     0000  3000 ;	Floating overflow can occur

                                     0000  3100 ;	Undefined exponentiation can occur if:

                                     0000  3200 ;		1)  Negative base

                                     0000  3300 ;		2)  0 base and power is 0 or negative.

                                     0000  3400 ;

                                     0000  3500 ;

                                     0000  3600 ;

                                     0000  3700 ;--

                                     0000  3800 ;

                                     0000  3900 ; VERSION: 0

                                     0000  4000 ;

                                     0000  4100 ; HISTORY:

                                     0000  4200 ;

                                     0000  4300 ; AUTHOR:

                                     0000  4400 ;	Jonathan Taylor, 28-Jun-77: Version 0

                                     0000  4500 ;

                                     0000  4600 ; MODIFIED BY:

                                     0000  4700 ;

                                     0000  4800 ;

                                     0000  4900 ;

OTS$POWRR       - REAL ** REAL power routine                     21-AUG-1978 19:10:25   VAX-11 MACRO X0.3-11               Page   2

0-7             HISTORY  ; Detailed current edit history                                                                         (2)



                                     0000   100 	.SBTTL	HISTORY		; Detailed current edit history

                                     0000   200 

                                     0000   300 

                                     0000   400 ; Edit history for Version 0 of OTS$POWRR

                                     0000   500 ;

                                     0000   600 ; version 0-2 Removed W^ from MTH$$ERROR.

                                     0000   700 ; version 0-3 changed MTH$$ERROR to MTH$$SIGNAL - JMT 5-OCT-77

                                     0000   800 ; 0-7	- Change FOR$FLAG_JACKET to MTH$FLAG_JACKET.  TNH 17-July-78

OTS$POWRR       - REAL ** REAL power routine                     21-AUG-1978 19:10:25   VAX-11 MACRO X0.3-11               Page   3

0-7             DECLARATIONS                                                                                                     (3)



                                     0000   100 	.SBTTL	DECLARATIONS

                                     0000   200 

                                     0000   300 ;

                                     0000   400 ; INCLUDE FILES:

                                     0000   500 ;

                                     0000   600 ;	OERR.MAR			; OTS error codes

                                     0000   700 

                                     0000   800 ;

                                     0000   900 ; EXTERNAL SYMBOLS:

                                     0000  1000 ;

                                     0000  1100 	.GLOBL	MTH$$SIGNAL		; Math error routine

                                     0000  1200 	.GLOBL	MTH$ALOG_R5		; floating logarithm

                                     0000  1300 	.GLOBL	MTH$EXP_R4		; floating exponental

                                     0000  1400 

                                     0000  1500 ;

                                     0000  1600 ; MACROS:

                                     0000  1700 ;

                                     0000  1800 

                                     0000  1900 ;

                                     0000  2000 ; EQUATED SYMBOLS:

                                     0000  2100 ;

                           00000004  0000  2200 	base	= 4			; base input formal - by-value

                           00000008  0000  2300 	exp	= 8			; exponent input formal - by-value

                                     0000  2400 

                                     0000  2500 ;

                                     0000  2600 ; OWN STORAGE:

                                     0000  2700 ;

                                     0000  2800 

                                     0000  2900 ;

                                     0000  3000 ; PSECT DECLARATIONS:

                                     0000  3100 ;

                                 00000000  3200 	.PSECT	OTS$CODE	PIC,SHR,LONG,EXE,NOWRT

                                     0000  3300 					; program section for OTS$ code

OTS$POWRR       - REAL ** REAL power routine                     21-AUG-1978 19:10:25   VAX-11 MACRO X0.3-11               Page   4

0-7             OTS$POWRR - REAL to REAL giving REAL result                                                                      (4)



                                     0000   100 	.SBTTL	OTS$POWRR - REAL to REAL giving REAL result

                                     0000   200 

                                     0000   300 ;++

                                     0000   400 ; FUNCTIONAL DESCRIPTION:

                                     0000   500 ;

                                     0000   600 ;	OTS$POWRR - REAL result = REAL base ** REAL exponent

                                     0000   700 ;

                                     0000   800 ;	The REAL result is given by:

                                     0000   900 ;

                                     0000  1000 ;	base	exponent	result

                                     0000  1100 ;	----	--------	------

                                     0000  1200 ;

                                     0000  1300 ;	= 0	> 0		0.0

                                     0000  1400 ;	= 0	= 0		Undefined Exponentiation

                                     0000  1500 ;	= 0	< 0		Undefined Exponentiation

                                     0000  1600 ;

                                     0000  1700 ;	< 0	any		Undefined Exponentiation

                                     0000  1800 ;

                                     0000  1900 ;	> 0	> 0		EXP(exp * LOG(base))

                                     0000  2000 ;	> 0	= 0		1.0

                                     0000  2100 ;	> 0	< 0		EXP(exp * LOG(base))

                                     0000  2200 ;

                                     0000  2300 ;

                                     0000  2400 ;	Floating Overflow can occur.

                                     0000  2500 ;	Undefined Exponentiation can occur if:

                                     0000  2600 ;		1)  base is 0 and exponent is 0 or negative

                                     0000  2700 ;		2)  base is negative

                                     0000  2800 ;

                                     0000  2900 ; CALLING SEQUENCE:

                                     0000  3000 ;

                                     0000  3100 ;	power.wf.v = OTS$POWRR (base.rf.v, exponent.rf.v)

                                     0000  3200 ;

                                     0000  3300 ; INPUT PARAMETERS:

                                     0000  3400 ;	base and exponent parameters are call by value

                                     0000  3500 ;

                                     0000  3600 ; IMPLICIT INPUTS:

                                     0000  3700 ;	none

                                     0000  3800 ;

                                     0000  3900 ; OUTPUT PARAMETERS:

                                     0000  4000 ;	none

                                     0000  4100 ;

                                     0000  4200 ; IMPLICIT OUTPUTS:

                                     0000  4300 ;	none

                                     0000  4400 ;

                                     0000  4500 ; FUNCTIONAL VALUE:

                                     0000  4600 ;	OTS$POWRR - REAL base ** REAL power

                                     0000  4700 ;

                                     0000  4800 ; SIDE EFFECTS:

                                     0000  4900 ;

                                     0000  5000 ;	SIGNALs SS$_ARITH with floating overflow hardware code if

                                     0000  5100 ;	floating overflow.

                                     0000  5200 ;	SIGNALs MTH$_UNDEXP (82 = ' UNDEFINED EXPONENTIATION') if

                                     0000  5300 ;		1)  base is 0 and exponent is 0 or negative

                                     0000  5400 ;		2)  base is negative

                                     0000  5500 ;

                                     0000  5600 ;

                                     0000  5700 ;--

OTS$POWRR       - REAL ** REAL power routine                     21-AUG-1978 19:10:25   VAX-11 MACRO X0.3-11               Page   5

0-7             OTS$POWRR - REAL to REAL giving REAL result                                                                      (5)



                               40FC' 0000   100 	.ENTRY	OTS$POWRR, ^M<IV,R2,R3,R4,R5,R6,R7> ; enable integer overflow

                                     0002   200 	MTH$FLAG_JACKET			; establish math error handler

                                     0002      

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

                                     0007       					; set handler address to jacket

                                     0007       					; handler

                                     0007       

            51         08 AC     50  0007   300 	MOVF	exp(AP), R1		; R1 = REAL exponent

            50         04 AC     50  000B   400 	MOVF	base(AP), R0		; R0 = REAL base

                          1D     13  000F   500 	BEQL	ZERO			; special case 0 ** n

                          21     19  0011   600 	BLSS	ERR			; negative base is an error

                          51     53  0013   700 	TSTF	R1			; test the exponent

                          13     13  0015   800 	BEQL	ONE			; special case n ** 0

            7E            51     50  0017   900 	MOVF	R1, -(SP)		; save exponent (R1) across call

                 00000000'EF     16  001A  1000 	JSB	MTH$ALOG_R5		; R0 = LOG(base)

            50            8E     44  0020  1100 	MULF	(SP)+, R0		; R0 = exp * LOG(base)

                 00000000'EF     16  0023  1200 	JSB	MTH$EXP_R4		; R0 = EXP(exp * LOG(base))

                                 04  0029  1300 	RET				; function value returned in R0

                                     002A  1400 

                                     002A  1500 ONE:

            50            08     50  002A  1600 	MOVF	#1, R0			; answer is one

                                 04  002D  1700 	RET				; returned in R0/R1

                                     002E  1800 

                                     002E  1900 ZERO:

                          50     D4  002E  2000 	CLRF	R0			; answer is zero

                          51     53  0030  2100 	TSTF	R1			; test the exponent (R1)

                          0F     14  0032  2200 	BGTR	RETURN			; return if positive exponent

                                     0034  2300 ERR:

            01            0F     78  0034  2400 	ASHL	#15, #1, R0		; R0 = undefined operand

                          50         0037       

            7E         52 8F     9A  0038  2500 	MOVZBL	#MTH__UNDEXP, -(SP)	; FORTRAN error number

   00000000'EF            01     FB  003C  2600 	CALLS	#1, MTH$$SIGNAL		; convert to 32-bit condition code

                                     0043  2700 					; and SIGNAL MTH$UNDEXP

                                     0043  2800 					; Note: 2nd arg not needed since

                                     0043  2900 					; no JSB OTS$POWRR is possible.

                                     0043  3000 RETURN:

                                 04  0043  3100 	RET				; return function value in R0/R1

                                     0044  3200 

                                     0044  3300 	.END

OTS$POWRR       - REAL ** REAL power routine                     21-AUG-1978 19:10:25   VAX-11 MACRO X0.3-11               Page   6

SYMBOL TABLE                                                                                                                     (5)



BASE           = 00000004            

ERR              00000034 R     02   

EXP            = 00000008            

FOR$K_ERR_PREFX= 00000018            

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

MTH$$SIGNAL      ********  GX   01   

MTH$ALOG_R5      ********  GX   01   

MTH$EXP_R4       ********  GX   01   

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            

ONE              0000002A R     02   

OTS$POWRR        00000000 RG    02   

RETURN           00000043 R     02   

ZERO             0000002E R     02   





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  

OTS$CODE         00000044      02       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

27886. BYTES LEFT IN FREE MEMORY POOL.

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

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

