C****************************************************************
C* 								*
C*								*
C*	DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY *
C*	EITHER FOR THE CREATION OR FOR THE CLINICAL EFFICACY	*
C*	OF THIS PROGRAM. USERS MUST ASSUME FULL RESPONSIBILITY	*
C*	FOR ANY RESULTS OR DIAGNOSES OBTAINED FROM THE USE	*
C*	OF THIS PROGRAM. QUESTIONS ON THE EXECUTION OF THIS	*
C*	PROGRAM MUST BE REFERRED BACK TO THE ORIGINAL AUTHOR.	*
C*								*
C* AUTHOR:	SALLY FORSTER					*
C*		C/O DEPARTMENT OF NUCLEAR MEDICINE		*
C*		GUY'S HOSPITAL				*
C*		LONDON, ENGLAND					*
C*								*
C*		TEL: 01-407-7600 EXT 2583/4			*
C*								*
C****************************************************************
	SUBROUTINE IADD(C)
	IMPLICIT INTEGER*2(D-Z)
	COMMON//SAVDES(256),CURVE1(512),CURVE2(512)
C*****IF C=0 ADD CURVE1 TO CURVE2
C*****IF C/=0 ADD C TO CURVE 1
	IF(C.NE.0)GOTO 20
	DO 10 I=1,SAVDES(108)
10	CURVE1(I)=CURVE1(I)+CURVE2(I)
	RETURN
20	CONTINUE
	DO 30 I=1,SAVDES(108)
30	CURVE1(I)=CURVE1(I)+C
	RETURN
	END
	SUBROUTINE SUB(C)
	IMPLICIT INTEGER*2(D-Z)
	COMMON//SAVDES(256),CURVE1(512),CURVE2(512)
C*****IF C=0 SUB CURVE2 FROM CURVE1
C*****IF C/=0 SUB C FROM CURVE 1
	IF(C.NE.0)GOTO 20
	DO 10 I=1,SAVDES(108)
	CURVE1(I)=CURVE1(I)-CURVE2(I)
10	IF(CURVE1(I).LT.0)CURVE1(I)=0
	RETURN
20	CONTINUE
	DO 30 I=1,SAVDES(108)
	CURVE1(I)=CURVE1(I)-C
30	IF(CURVE1(I).LT.0)CURVE1(I)=0
	RETURN
	END
	SUBROUTINE MULT(C)
	IMPLICIT INTEGER*2(D-Z)
	COMMON//SAVDES(256),CURVE1(512),CURVE2(512)
C*****IF C=0 MULTIPLY CURVE1 BY CURVE2
C*****IF C/=0 MULTIPLY CURVE1 BY C
	IF(C.NE.0)GOTO 20
	DO 10 I=1,SAVDES(108)
10	CURVE1(I)=CURVE1(I)*CURVE2(I)
	RETURN
20	CONTINUE
	DO 30 I=1,SAVDES(108)
30	CURVE1(I)=CURVE1(I)*C
	RETURN
	END
	FUNCTION DIV(C)
	IMPLICIT INTEGER*2(D-Z)
	COMMON//SAVDES(256),CURVE1(512),CURVE2(512)
C*****IF C=0 DIVIDE CURVE1 BY CURVE2
C*****IF C/=0 DIVIDE CURVE1 BY C 
	DIV=0
	IF(C.NE.0)GOTO 20
	IF(PCV(1,12).LT.0)GOTO 100
	DO 10 I=1,SAVDES(108)
	IF(CURVE2(I).LT.0.1)GOTO 80
10	CURVE1(I)=CURVE1(I)/CURVE2(I)
	RETURN
20	IF(C.LE.0.1)GOTO 90
	DO 30 I=1,SAVDES(108)
30	CURVE1(I)=CURVE1(I)/C
	RETURN
80	IF(GCV(1,12).LT.0)GOTO 100
90	WRITE(7,200)
	RETURN
100	DIV=-1
	RETURN
200	FORMAT(1X,'UNSTABLE DIVIDE COMMAND IGNORED')
	END
