MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   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$DSIN  - Standard Double Precision Floating 

   (5)     100  MTH$DCOS  - Standard Double Precision Floating 

   (6)     100  MTH$DSINCOS_R7  - special DCOS/DSIN routines

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   1

0-8                                                                                                                              (1)



                                     0000   100 	.TITLE	MTH$DSINCOS 	; Double Floating Point Sine and Cosine Functions

                                     0000   200 				; (DSIN,DCOS)

                                     0000   300 	.IDENT /0-8/		; File: MTHDSINCO.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$DSIN and MTH$DCOS are functions which return the double precision

                                     0000  2900 ; floating point sine  or cosine value of their double precision float-

                                     0000  3000 ; ing point argument (radians). The call is standard call-by-reference.

                                     0000  3100 ; MTH$DSIN_R7  and  MTH$DCOS_R7 are special routines which are the same

                                     0000  3200 ; as MTH$DSIN  and  MTH$DCOS  except  a faster non-standard JSB call is

                                     0000  3300 ; used with the argument in R0 and no registers are saved.

                                     0000  3400 ;

                                     0000  3500 ;--

                                     0000  3600 ;

                                     0000  3700 ; VERSION: 0

                                     0000  3800 ;

                                     0000  3900 ; HISTORY:

                                     0000  4000 ; AUTHOR:

                                     0000  4100 ;	Tom Hastings, 28-Sept-76: Version 0

                                     0000  4200 ;

                                     0000  4300 ; MODIFIED BY:

                                     0000  4400 ;

                                     0000  4500 ; 0-1	Peter Yuo, 22-May-77

                                     0000  4600 ;

                                     0000  4700 ;

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   2

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



                                     0000   100 	.SBTTL	HISTORY	; Detailed Current Edit History

                                     0000   200 

                                     0000   300 

                                     0000   400 ; ALGORITHMIC DIFFERENCES FROM FP-11C ROUTINE (V19):

                                     0000   500 ;	1. uses POLYD and EMODD which have better accuracy.

                                     0000   600 ;	2. Checks for 1 - 2**-28 before polynomial instead of checking

                                     0000   700 ;	   for greater than 1.0 afterwards.

                                     0000   800 ;	3. Signals complete loss of significance.

                                     0000   900 ;

                                     0000  1000 ; Edit History for Version 0 of MTH$DSINCOS 

                                     0000  1100 ;

                                     0000  1200 ; 0-1	Code saving after code review

                                     0000  1300 ;	Fix bug so test |X| for small angle, not X

                                     0000  1400 ; 0-2	Finish error handling 10-june-1977

                                     0000  1500 ; 0-3

                                     0000  1600 ; 0-4	28-Jul-1977

                                     0000  1700 ;	Made faster by using CMPW instead of CMPD, also XORW instead of

                                     0000  1800 ;	MNEGD.

                                     0000  1900 ; 0-5	16-Sep-1977

                                     0000  2000 ;	Correct a bug by putting # sign in front of WD_EPSLON

                                     0000  2100 ; 0-6	MTH$$ERROR changed to MTH$$SIGNAL.

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

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

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

                                     0000  2500 ; 0-8	Move .ENTRY definition to module header.  TNH 14-Aug-78

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   3

0-8             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   800 ; EQUATED SYMBOLS:

                                     0000   810 

                           000040FC  0000   820 	ACMASK = ^M<IV, R2, R3, R4, R5, R6, R7>

                                     0000   830 					; register save mask and IV enable

                           00004080  0000   900 	SD_1		= ^F1.0		; short double floating literal 1.0

                                     0000  1000 					; exp = 1, frac = 0

                           00005000  0000  1100 	WD_2_POWER_31	= ^O050000	; first word of double 2**31,

                                     0000  1200 					; the largest longword binary integer

                           0000002A  0000  1300 	X_2_OVER_PI	= ^O052		; extension operand for EMOD for D_2_OVER_PI

                           00003280  0000  1400 	WD_EPSLON	= ^X3280	; first word of double 2**-28

                                     0000  1500 

                                     0000  1600 ;

                                     0000  1700 ; MACROS:	none

                                     0000  1800 ;

                                     0000  1900 ; PSECT DECLARATIONS:

                                     0000  2000 

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

                                     0000  2200 					; program section for math routines

                                     0000  2300 ;

                                     0000  2400 ; OWN STORAGE:	none

                                     0000  2500 ;

                                     0000  2600 ; CONSTANTS:

                                     0000  2700 

                                     0000  2800 

                                     0000  2900 SINTAB:					; table of ordered coefficients 

                                     0000  3000 					; for use in POLY

                          8DC3 2DCE  0000  3100 	.WORD	^O026716,^O106703	; C8 = .587061098171E-11

                          CCF2 4ABF  0004  3200 	.WORD	^O045277,^O146362

                          BCBB B137  0008  3300 	.WORD	^O130467,^O136273	; C7 = -.66843217206396E-9

                          A66B 862C  000C  3400 	.WORD	^O103054,^O123153

                          79AF 3474  0010  3500 	.WORD	^O032164,^O074657	; C6 = .5692134872719023E-7

                          D9E2 4EAC  0014  3600 	.WORD	^O047254,^O154742

                          83A6 B771  0018  3700 	.WORD	^O133561,^O101646	; C5 = -.3598843007208693E-5

                          B80E EE8E  001C  3800 	.WORD	^O167216,^O134016

                          3C1A 3A28  0020  3900 	.WORD	^O035050,^O036032	; C4 = +0.0001604411847068221

                          8659 428C  0024  4000 	.WORD	^O041214,^O103131

                          6966 BC99  0028  4100 	.WORD	^O136231,^O064546	; C3 = -0.004681754135302643

                          AA14 7313  002C  4200 	.WORD	^O071423,^O125024

                          35E3 3EA3  0030  4300 	.WORD	^O037243,^O032743	; C2 = +0.07969262624616544

                          536F 3BAD  0034  4400 	.WORD	^O035655,^O051557

                          5DE7 C025  0038  4500 	.WORD	^O140045,^O056747	; C1 = -0.6459640975062462

                          F292 312D  003C  4600 	.WORD	^O030455,^O171222

                                     0040  4700 D_PI_OVER_2:

                          0FDA 40C9  0040  4800 	.WORD	^O040311,^O007732	; C0 = PI/2 = 1.570796326794897

                          68C2 A221  0044  4900 	.WORD	^O121041,^O064302

                           00000009  0048  5000 SINLEN = .-SINTAB/8			; no. of floating point entries

                                     0048  5100 

                                     0048  5200 D_2_OVER_PI:

                          F983 4022  0048  5300 	.WORD	^O040042,^O174603	; double precision 1/(PI/2) = 2/PI

                          4415 6E4E  004C  5400 	.WORD	^O067116,^O042025

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   4

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



                                     0050  5500 

                                     0050  5600 D_1_MI_EPSLON:				; 1 - 2**-28

                0000 F000 FFFF 407F  0050  5700 	.WORD	^O040177, ^O177777, ^O170000, 0

                                     0058  5800 

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   5

0-8             MTH$DSIN  - Standard Double Precision Floating                                                                   (4)



                                     0058   100 	.SBTTL	MTH$DSIN  - Standard Double Precision Floating Sine

                                     0058   200 

                                     0058   300 

                                     0058   400 ;++

                                     0058   500 ; FUNCTIONAL DESCRIPTION:

                                     0058   600 ;

                                     0058   700 ; DSIN  - double precision floating point function

                                     0058   800 ;

                                     0058   900 ; DSIN(X) is computed using the following approximation technique:

                                     0058  1000 ;

                                     0058  1100 ;	Let Q = INTEGER(|X|/(PI/2))

                                     0058  1200 ;		i.e.	Q = 0 for first quadrant,

                                     0058  1300 ;			Q = 1 for second quadrant,

                                     0058  1400 ;			Q = 2 for third quadrant,

                                     0058  1500 ;			Q = 3 for fourth quadrant.

                                     0058  1600 ;

                                     0058  1700 ;	Let Y = FRACTION((|X|/(PI/2))

                                     0058  1800 ;

                                     0058  1900 ;	For ABS(Y) < 2**-28 the sine is computed as:

                                     0058  2000 ;

                                     0058  2100 ;		DSIN(X) = S * (PI/2)

                                     0058  2200 ;		where

                                     0058  2300 ;		      S = Y			if Q = 0,

                                     0058  2400 ;			= 1-Y   		if Q = 1,

                                     0058  2500 ;			= -Y			if Q = 2,

                                     0058  2600 ;			= Y-1			if Q = 3.

                                     0058  2700 ;

                                     0058  2800 ;	Otherwise

                                     0058  2900 ;		DSIN(X)	= P(Y*PI/2)		if Q = 0

                                     0058  3000 ;			= P((1-Y)*PI/2)		if Q = 1

                                     0058  3100 ;			= P(-Y*PI/2)		if Q = 2

                                     0058  3200 ;			= P((Y-1)*PI/2)		if Q = 3

                                     0058  3300 ;

                                     0058  3400 ;	where P(Y) = Y*SUM(Ci*(Y**(2*i)))	for i = 0:8

                                     0058  3500 ;

                                     0058  3600 ;	The polynomial approximation used is of degree 8.

                                     0058  3700 ;

                                     0058  3800 ;	The relative error is less than or equal to 10**-18.6.

                                     0058  3900 ;	The result is garanteed to be in the closed interval -1.0 to +1.0.

                                     0058  4000 ;

                                     0058  4100 ;	No loss of precision occurs if |X| < 2 * PI * 256.

                                     0058  4200 ;	Error messages: "SIN or COS SIGNIFICANCE LOST" if |X|>= 2 * PI * 2**31.

                                     0058  4300 ;

                                     0058  4400 ; CALLING SEQUENCE:

                                     0058  4500 ;

                                     0058  4600 ;	dsine.wd.v = MTH$DSIN(x.rd.r)

                                     0058  4700 ;

                                     0058  4800 ; INPUT PARAMETERS:

                                     0058  4900 

                           00000004  0058  5000 	LONG = 4			; define longword multiplier

                           00000004  0058  5100 	x = 1 * LONG			; x is an angle in radians

                                     0058  5200 

                                     0058  5300 ; IMPLICIT INPUTS:	none

                                     0058  5400 ;

                                     0058  5500 ; OUTPUT PARAMETERS:

                                     0058  5600 ;

                                     0058  5700 ;	VALUE:	double floating sine of the angle in radian

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   6

0-8             MTH$DSIN  - Standard Double Precision Floating                                                                   (4)



                                     0058  5800 ;

                                     0058  5900 ; IMPLICIT OUTPUTS:	none

                                     0058  6000 ;

                                     0058  6100 ; COMPLETION CODES:	none

                                     0058  6200 ;

                                     0058  6300 ; SIDE EFFECTS:

                                     0058  6400 ;

                                     0058  6500 ; Signals: MTH$_SINSIGLOS if |X| > 2*PI*2**31 with reserved operand in R0/R1

                                     0058  6600 ; (copied to the signal mechanism vector CHF$L_MCH_R0/R1 by LIB$SIGNAL).

                                     0058  6700 ; Associated message is: "SIN OR COS SIGNIFICANCE LOST". Result is reserved

                                     0058  6800 ; operand -0.0 unless a user supplied (or any) error handler changes CHF$L_MCH_R0/R1

                                     0058  6900 ;

                                     0058  7000 ; NOTE: This procedure disables floating point underflow, enables integer

                                     0058  7100 ; overflow, causes no floating overflow or other arithmetic traps, and

                                     0058  7200 ; preserves enables across the call.

                                     0058  7300 ;

                                     0058  7400 ;---

                                     0058  7500 

                                     0058  7600 

                               40FC' 0058  7700 	.ENTRY	MTH$DSIN ,ACMASK	; standard call-by-reference entry

                                     005A  7800 					; disable DV (and FU), enable IV

                                     005A  7900 	MTH$FLAG_JACKET			; flag that this is a jacket procedure in

                                     005A      

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

                                     005F       					; set handler address to jacket

                                     005F       					; handler

                                     005F       

                                     005F  8000 					; case of an error in special JSB routine

            50         04 BC     70  005F  8100 	MOVD	@x(AP), R0		; R0/R1 = arg (angle in radians)

                          26     10  0063  8200 	BSBB	MTH$DSIN_R7 		; call special DSIN rountine

                                 04  0065  8300 	RET				; return - result in R0/R1

                                     0066  8400 

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   7

0-8             MTH$DCOS  - Standard Double Precision Floating                                                                   (5)



                                     0066   100 	.SBTTL	MTH$DCOS  - Standard Double Precision Floating Cosine

                                     0066   200 

                                     0066   300 ;++

                                     0066   400 ; FUNCTIONAL DESCRIPTION:

                                     0066   500 ;

                                     0066   600 ; DCOS  - single precision floating point function

                                     0066   700 ;

                                     0066   800 ; DCOS(X) is computed as DSIN(X+PI/2).

                                     0066   900 ;

                                     0066  1000 ; See description of MTH$DSIN 

                                     0066  1100 ;

                                     0066  1200 ; CALLING SEQUENCE:

                                     0066  1300 ;

                                     0066  1400 ;	dcosine.wd.v = MTH$DCOS(x.rd.r)

                                     0066  1500 ;

                                     0066  1600 ; INPUT PARAMETERS:

                                     0066  1700 

                           00000004  0066  1800 	LONG = 4			; define longword multiplier

                           00000004  0066  1900 	x = 1 * LONG			; x is an angle in radians

                                     0066  2000 

                                     0066  2100 ; IMPLICIT INPUTS:	none

                                     0066  2200 ;

                                     0066  2300 ; OUTPUT PARAMETERS:

                                     0066  2400 ;

                                     0066  2500 ;	VALUE:	double floating cosine of the angle in radians.

                                     0066  2600 ;

                                     0066  2700 ; IMPLICIT OUTPUTS:	none

                                     0066  2800 ;

                                     0066  2900 ; COMPLETION CODES:	none

                                     0066  3000 ;

                                     0066  3100 ; SIDE EFFECTS:	See description of MTH$DSIN 

                                     0066  3200 ;

                                     0066  3300 ;--

                                     0066  3400 

                                     0066  3500 

                               40FC' 0066  3600 	.ENTRY	MTH$DCOS, ACMASK	; standard call-by-reference entry

                                     0068  3700 					; disable DV (and FU), enable IV

                                     0068  3800 	MTH$FLAG_JACKET			; flag that this is a jacket procedure in

                                     0068      

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

                                     006D       					; set handler address to jacket

                                     006D       					; handler

                                     006D       

                                     006D  3900 					; case of an error in special JSB routine

            50         04 BC     70  006D  4000 	MOVD	@x(AP), R0		; R0/R1 = arg (angle in radians)

                          01     10  0071  4100 	BSBB	MTH$DCOS_R7 		; call special DCOS routine

                                 04  0073  4200 	RET				; return - result in R0/R1

                                     0074  4300 

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   8

0-8             MTH$DSINCOS_R7  - special DCOS/DSIN routines                                                                     (6)



                                     0074   100 	.SBTTL	MTH$DSINCOS_R7  - special DCOS/DSIN routines

                                     0074   200 

                                     0074   300 ; special DCOS/DSIN - used by the standard and directly.

                                     0074   400 ;

                                     0074   500 ; CALLING SEQUENCE:

                                     0074   600 ;	save anything needed in R0:R7

                                     0074   700 ;	MOVD	...,R0		; input in R0/R1

                                     0074   800 ;	JSB	MTH$DCOS_R7 /MTH$DSIN_R7 

                                     0074   900 ;	return with result in R0/R1

                                     0074  1000 ; Note: This routine is written to avoid causing any integer overflows, floating

                                     0074  1100 ; overflows, or floating underflows or divide by 0 conditions, whether enabled or

                                     0074  1200 ; not.

                                     0074  1300 ;

                                     0074  1400 ; REGISTERS USED:

                                     0074  1500 ;	R0/R1 - double floating argument then result

                                     0074  1600 ;	R2/R3 - |X| then Q

                                     0074  1700 ;	R0:R5 - POLYD

                                     0074  1800 ;	R6/R7 - Y during POLYD

                                     0074  1900 

                                     0074  2000 

                                     0074  2300 

                                     0074  2400 MTH$DCOS_R7::				; special DCOS routine

            50       8000 8F     AA  0074  2500 	BICW	#^X8000, R0		; R0/R1 = |X|, because COS(-X) = COS(X)

                                     0079  2600 					; the effective sign of X is positive

       5000 8F            50     B1  0079  2700 	CMPW	R0, #WD_2_POWER_31	; compare |X| with largest longword integer

                                     007E  2800 					; value before integer overflow(2**31)

                          57     18  007E  2900 	BGEQ	TOOBIG			; branch if EMODD would get integer overflow

                                     0080  3000 					; error, also half of significant bits lost

            2A         C5 AF     74  0080  3100 	EMODD	D_2_OVER_PI, #X_2_OVER_PI, R0, R2, R6

            52            50         0084       

                          56         0086       

                                     0087  3200 					; R6/R7 = Y = FRACTION(|X|/(PI/2))

                                     0087  3300 					; R2 = Q = INTEGER(|X|/(PI/2))

                                     0087  3400 					; Never integer overflow

                          52     D6  0087  3500 	INCL	R2			; next quadrant since COS(X) = SIN(X+PI/2)

                          19     11  0089  3600 	BRB	SINCOS			; join common code

                                     008B  3700 

                                     008B  3800 

                                     008B  3900 MTH$DSIN_R7::				; special SIN routine

            50   00008000 8F     CB  008B  4000 	BICL3	#^X8000, R0, R2		; R2 = |X|,

                          52         0092       

            53            51     D0  0093  4100 	MOVL	R1, R3			; R2/R3 = |X|,

       5000 8F            52     B1  0096  4200 	CMPW	R2, #WD_2_POWER_31	; compare |X| with largest longword integer

                                     009B  4300 					; value before integer overflow(2**31)

                          3A     18  009B  4400 	BGEQ	TOOBIG			; branch if EMODD would get integer overflow

                                     009D  4500 					; error, also half of significant bits lost

            2A         A8 AF     74  009D  4600 	EMODD	D_2_OVER_PI, #X_2_OVER_PI, R2, R2, R6

            52            52         00A1       

                          56         00A3       

                                     00A4  4700 					; R6/R7 = Y = FRACTION(|X|/PI/2))

                                     00A4  4800 					; R2 = Q = INTEGER(|X|/(PI/2))

                                     00A4  4900 					; Never integer overflow

                                     00A4  5000 ;

                                     00A4  5100 ; common code for SIN and COS

                                     00A4  5200 ;

                                     00A4  5300 SINCOS:

            04            52     E9  00A4  5400 	BLBC	R2, Q13			; branch if first or third quadrant(Q = 0,2)

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page   9

0-8             MTH$DSINCOS_R7  - special DCOS/DSIN routines                                                                     (6)



            08            56     63  00A7  5500 	SUBD3	R6, S^#SD_1, R6		; R6/R7 = 1.0 - Y for second or fourth quadrant

                          56         00AA       

                                     00AB  5600 					; (Q = 1,3)

                                     00AB  5700 ;

                                     00AB  5800 ; check if Z is too small or near to 1,

                                     00AB  5900 ;	 where Z = Y for first or third quadrant(Q = 0,2)

                                     00AB  6000 ;		 = 1.0-Y for third or fourth quadrant(Q = 1,3)

                                     00AB  6100 ;

       3280 8F            56     B1  00AB  6200 Q13:	CMPW	R6, #WD_EPSLON		; compare Z with 2**-28

                          35     15  00B0  6300 	BLEQ	SMALL			; branch to SMALL if Z =< 2**-28

         9A AF            56     71  00B2  6400 	CMPD	R6, D_1_MI_EPSLON	; compare Z with 1 - 2**-28

                          44     18  00B6  6500 	BGEQ	ONE			; branch to ONE if Z >= 1 - 2**-28

                                     00B8  6600 ;

                                     00B8  6700 ; 2**-28 =< Z < 1 - 2**-28

                                     00B8  6800 ;

            52            01     E1  00B8  6900 	BBC	#1, R2, Q12		; branch to Q12 if Z is in 1st or 2nd

                          05         00BB       

                                     00BC  7000 					; quadrant(Q=0,1)

            56       8000 8F     AC  00BC  7100 	XORW	#^X8000, R6		; R6/R7 = - Y for third quadrant(Q = 2),

                                     00C1  7200 					;    = Y-1.0 for fourth quadrant(Q = 3)

                                     00C1  7300 					; Note: -0.0 not produced since Z > 0

            50       7FFF 8F     AA  00C1  7400 Q12:	BICW	#^X7FFF, R0		; clear all but sign in original X

            56            50     AC  00C6  7500 	XORW	R0, R6			; if X < 0, change sign of Z since

                                     00C9  7600 					; SIN(-Z) = - SIN(Z)

                                     00C9  7700 					; Note: -0.0 not produced since R6 > 0

            56            56     65  00C9  7800 	MULD3	R6, R6, R0		; R0/R1 = Z ** 2

                          50         00CC       

            08            50     75  00CD  7900 	POLYD	R0, #SINLEN-1, SINTAB	; R0/R1 = SUM(Ci*((Z**2)*i)) i=0:8

                     FF2D CF         00D0       

            50            56     64  00D3  8000 	MULD	R6, R0			; R0/R1 = ((SIGN(X)*Z) * SUM

                                 05  00D6  8100 	RSB				; return

                                     00D7  8200 ;

                                     00D7  8300 ; Argument too big, half of significance lost. Signal error then return reserved

                                     00D7  8400 ; operand -0.0

                                     00D7  8500 ;

                          6E     DD  00D7  8600 TOOBIG:	PUSHL	(SP)			; return PC from JSB routine

            7E         57 8F     9A  00D9  8700 	MOVZBL	#MTH__SINSIGLOS, -(SP)	; condition value

            01            0F     79  00DD  8800 	ASHQ	#15, #1, R0		; R0/R1 = result = reserved operand -0.0

                          50         00E0       

                                     00E1  8900 					; goes to signal mechanism vector

                                     00E1  9000 					; (CHF$L_MCH_R0/R1) so error handler

                                     00E1  9100 					; can modify the result.

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

                                     00E6  9300 					; independent of CALL vs JSB

                                 05  00E6  9400 	RSB				; return - R0/R1 restored from CHF$L_MCH_R0/R1

                                     00E7  9500 

                                     00E7  9600 ;

                                     00E7  9700 ; Z =< 2**-28, return S 

                                     00E7  9800 ;

            52            01     E1  00E7  9900 SMALL:	BBC	#1, R2, 1$ 		; branch if Z is in 1st or 2nd quadrant

                          03         00EA       

                                     00EB 10000 					; (Q = 0,1)

            56            56     72  00EB 10100 	MNEGD	R6, R6			; negate Z if Z is in 3rd or 4th quadrant

                                     00EE 10200 					;(Q = 2,3)

                          50     73  00EE 10300 1$:	TSTD	R0			; test the sign of X

                          03     18  00F0 10400 	BGEQ	2$			; branch if X >= 0

            56            56     72  00F2 10500 	MNEGD	R6, R6			; X < 0, change sign of Z

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page  10

0-8             MTH$DSINCOS_R7  - special DCOS/DSIN routines                                                                     (6)



                                     00F5 10600 					; since SIN(-Z) = - SIN(Z)

            56       FF47 CF     65  00F5 10700 2$:	MULD3	D_PI_OVER_2, R6, R0	; multiply Z by PI/2 because of EMOD

                          50         00FA       

                                 05  00FB 10800 	RSB				; return, R0/R1 = SIN(Z) = Z, for Z small

                                     00FC 10900 

                                     00FC 11000 ;

                                     00FC 11100 ; Z >= 1 - 2**-28, return +1.0 or -1.0

                                     00FC 11200 ;

            52            01     E1  00FC 11300 ONE:	BBC	#1, R2, 1$		; branch if Z is in 1st or 2nd quadrant

                          03         00FF       

                                     0100 11400 					; (Q=0,1)

            50            50     52  0100 11500 	MNEGF	R0, R0			; complement sign of original X if Z is in

                                     0103 11600 					; 3rd or 4th quadrant(Q=2,3)

            50   FFFF7FFF 8F     CA  0103 11700 1$:	BICL	#^XFFFF7FFF, R0		; clear all but sign bit in original X

            50       4080 8F     A8  010A 11800 	BISW	#^X4080, R0		; make result be +1.0 or -1.0 by

                                     010F 11900 					; ORing in magnitude 1.0

                          51     D4  010F 12000 	CLRL	R1			; lower part = 0

                                 05  0111 12100 	RSB				; return R0/R1 = +1.0 or -1.0

                                     0112 12200 

                                     0112 12300 	.END

MTH$DSINCOS     ; Double Floating Point Sine and Cosine Functio  21-AUG-1978 19:05:00   VAX-11 MACRO X0.3-11               Page  11

SYMBOL TABLE                                                                                                                     (6)



ACMASK         = 000040FC            

D_1_MI_EPSLON    00000050 R     02   

D_2_OVER_PI      00000048 R     02   

D_PI_OVER_2      00000040 R     02   

FOR$K_ERR_PREFX= 00000018            

LONG           = 00000004            

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

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

MTH$DCOS         00000066 RG    02   

MTH$DCOS_R7      00000074 RG    02   

MTH$DSIN         00000058 RG    02   

MTH$DSIN_R7      0000008B 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            

ONE              000000FC R     02   

Q12              000000C1 R     02   

Q13              000000AB R     02   

SD_1           = 00004080            

SINCOS           000000A4 R     02   

SINLEN         = 00000009            

SINTAB           00000000 R     02   

SMALL            000000E7 R     02   

TOOBIG           000000D7 R     02   

WD_2_POWER_31  = 00005000            

WD_EPSLON      = 00003280            

X              = 00000004            

X_2_OVER_PI    = 0000002A            





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





THERE WERE NO ERRORS OR WARNINGS.

27598. BYTES LEFT IN FREE MEMORY POOL.

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

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

