	.TITLE  REAL FLOATING POINT 
	.GLOBL .AH,.AP,.AO,.AG,.AI,.AR
	.GLOBL .AK,.AT,.AQ,.AL,.AU,.AM
	.GLOBL .BA,.AA,.AB,.AC,.AW,.AX
	.GLOBL .AJ,.AS,.AV,.AN,.CB,.ER
	.GLOBL .RB,.FS,.CH,.CD,.ZS
	.GLOBL .CI,.CE,.T1,.SET,.CC,.CA
	.GLOBL .A4,.HS,.HX,.RE,.SP
	/.AH-STORE SINGLE PRECISION
.AH	CAL	0
	LAC*	.AH
	JMS	.CB	/CLEARS LINK
	JMS	.ZRSN	/CHECK FOR 0
	LAC	.AA
	DAC*	CE14	/SAVE EX
	SZL
	JMP	AH01	/0 RESULT
	LAC	STW
	DAC	ERN
	LAC	.AC
	TAD	REAL02	/ROUND BIT
	AND	REAL04	/EXTRACT LO
	DAC	T2	/SAVE LO
	GLK
	TAD	.AB
	SNA		/=0?
	TAD	(600000	/YES
	SAD	CN01	/=400000?
	JMP	.-2	/YES
/IF ARITH OV L=1,A=200000 IF+,A=600000 IF-
	DAC	T1	/SAVE HI
	GLK		/0 IF NO OV
	TAD*	CE14	/CHECK EX
	TAD	(377400	/FOR OV
	SZL		/& UNF
	JMP	.OV	/L=1,A0=0
	TAD	(1000
	SNL!CLL
	JMP	UNF	/L=0,A0=1
	XOR	T2	/ADD LO
	XOR	REAL02	/CHANGE SIGN
	DAC*	CE14	/STORE LO-EX
	LAC	T1
AH01	ISZ	CE14
	DAC*	CE14	/STORE HI
	JMP*	.AH
UNF	LAW	2
	JMS	ERP
	CLA!STL		/CREATE 0
	JMP	.AH+5
/
	/.AP-STORE DOUBLE PRECISION
.AP	CAL	0
	LAC*	.AP
	JMS	.CB	/GET ARG
	JMS	.ZRSN	/CHECK FOR 0
	LAC	.AA
	SNL
	XOR	CN01	/REMOVE BIAS
	DAC*	CE14	/STORE EX
	ISZ	CE14
	LAC	.AB
	DAC*	CE14	/STORE HI
	ISZ	CE14
	LAC	.AC
	DAC*	CE14	/STORE L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MUL		/Q1*D2'
CI01	CAL	0
	TAD	.AC	/R+Q1*D2'
	DAC	.AC
	LACQ		/GET LO PART
	TAD	.A4	/+ 2 LO BITS
	LMQ
	GLK
	TAD	.AC	/NEW NUM.
	LRS	2	/AVOID OVF
	JMS	DIVR	/Q2
	DAC	.A4	/R2
	LACQ
	DAC	.AC	/Q2
	MUL
CI02	CAL	0	/Q2*D2'
	TAD	.A4	/R2+Q2*D2'
	LRS	2	/AVOID OVF
	JMS	DIVR	/Q3
	641604		/CLA+LLS4
	DAC	T1
	LACQ		/SHIFTED Q3
	DAC	.A4
	LAC	.AC
	LMQ		/Q2 TO MQ
	641602		/CLA+LLS2
	TAD	.AB
	DAC	.AB	/HI QUOTIENT
	LACQ
	TAD	T1	/Q2+Q3
	DAC	.AC	/LO QUOTIENT
	SZL!CLL
	ISZ	.AB
	LAC	(377776	/BIAS
	JMS	ADN	/+ .AA EXT
	CMA
	DAC	.AAG
	LAC	.AA
	CMA
	DAC	.AA
	LAC	.CE	/FORM SIGN
	DAC	CE05
	JMS	.NORD	/NORM-RD-OV
	JMP*	.CI
DIVF	LAW	3	/0 OR UNORM
	JMP	.OV+1	/DIVISOR
DIVR	CAL	0
	DIV
CI03	CAL	0
	JMP*	DIVR
/
	/ CONSTANTS-WORKING STORE
.AAG	0	/.AA EXTEN
.AA	0	/FAC
.AB	0
.AC	0
.A4	0	/GUARD WORD
CE01	0	/HAC
CE02	0
CE03	0
.FS	0	/FAC SIGN
.HS	0	/HAC SIGN
.CE	0	/COMBINED SIGN
CE14	0	/OPERAND ADDRESS
.T1	0	/TEMP STORE
	0
	0
REAL02	400
REAL03	777
REAL04	777000
REAL05	377400
CN01	400000
CN02	377777
CN03	1
.HX=CE01
CEHS=.HS
CE05=.FS
TP1=.T1
/
	/MULT ROUTINE-.CA
.CA	XX
	LAC	.AC
	DAC	CA01
	DAC	CA02
	LAC	.AB
	DAC	CA03
	DAC	CA04
	CLL
	LAC	CE03
	MUL		/LO*LO
CA01	CAL	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P*	.SET
/
	/.FRE-.FDB ARG TO HAC
	/.CG-SIGN CONTROL
.FRE	CAL	0
	LAC*	.FRE
	DAC	ERN
	LAC	.SET
	DZM	.SET
	SZA
	JMP	.FDB
	LAC*	CE14	/SINGLE PREC
	AND	REAL04	/EXTRACT LO
	DAC	CE03
	LAC*	CE14
	AND	REAL03	/EXTRACT EX
	XOR	REAL02	/CHANGE SIGN
	TAD	REAL05	/BIAS EX
	DAC	CE01
	ISZ	CE14
	LAC*	CE14
.CG	SAD	CE03	/FRAC = ?
	SZA!CLL		/YES, =0?
	SKP!CLL
	DZM	CE01
	TAD	CN01	/SIGN TO L
	AND	CN02	/ABS VALUE
	DAC	CE02	/OF FRAC
	GLK
	DAC	CEHS	/SAVE SIGN
	XOR	CE05
	DAC	.CE	/JOINT SIGN
	DZM	.AAG	/0 TO .AA EX
	LAC	.AB	/ABS VALUE
	AND	CN02	/OF FAC
	DAC	.AB
	ISZ	.FRE
	JMP*	.FRE
.FDB	LAC*	CE14	/DOUBLE PREC
	XOR	CN01	/ADD BIAS
	DAC	CE01
	ISZ	CE14
	LAC*	CE14
	DAC	CE02
	ISZ	CE14
	LAC*	CE14
	DAC	CE03
	LAC	CE02
	JMP	.CG
/
	/.BA-NEGATE FAC
.BA	CAL	0
	ISZ	CE05
	JMS	.ZRSN
	JMP*	.BA
T2=.BA
/
	/.AW-INTEGER T0 FLOAT
	/INTEGER IN A
.AW	CAL	0
	DZM	CE05	/SET SIGN +
	DZM	.AC	/0 TO LOW
	DZM	.A4	/FRACS
	SMA
	JMP	AW01
	CMA		/2'S COMPL
	TAD	CN03
	ISZ	CE05	/SET SIGN -
AW01	DAC	.AB
	LAC	AW02	/FORM EXP
	DAC	.AA
	JMS	.CD	/NORM
	JMS	.ZRSN	/PACK SIGN
	JMP*	.AW
AW02	400021
M22=CD02
/
	/.AX-FLOAT TO INTEGER
/IF I>18 BITS,RIGHTMOST 18 BITS GIVEN &
/OTS 0.  -2**17 IS CONVERTED
.AX	CAL	0
	JMS	.AP	/SAVE FAC
		TP1
	LAC	TP1	/UNBIAS EXP
	TAD	M22	/FORM EXDEL
	LRSS		/SIGN TO L
	SNA!CLC		/EXDEL=0 ?
	LAC	.AC	/YES
	SMA!CLA		/.AC + ?
	LAC	.AB	/YES
	SAD	(600000
	JMP	AX02	/= -2**17
AX01	SZL		/EXDEL - ?
	JMP	AX02
	LAC	.AX
	DAC	ERA
	ISZ	ERA
	LAC	(77777
	DAC	ERN
AT	LAW	0	/OTS 0
	JMS	ERP	/INTEGER OV
AX02	JMS	.AG	/LD 2**35
		TWO35	/ARG TO HAC
	LAC	TP1+1	/SIGN OF ARG
	SPA
	ISZ	.AA	/2**36 IF -
	JMS	.CC	/ADD HAC
	JMS	.CD	/NORMALIZE
	JMS	.AO	/RESTORE FAC
		TP1	/.AC TO CE03
			/.AB IN A
	SPA!CLA		/ARG - ?
	LAC	.A4	/YES
	SZA!CLA		/RESIDUE 0 ?
	ISZ	CE03	/NO,RD UP
	LAC	CE03	/= INTEGER
	JMP*	.AX
TWO35	43
	200000
/
/ERROR REPORT ROUTINE
ERP	XX
	DAC	ERC
	LAC	ERN
	LRSS+11		/SHIFT R9
	TAD	AT
	DAC	ERN
	LLS+1011	/CLEAR A, L9
	TAD	AT
	DAC	ERN+1
	LAC	ERA
	AND	(77777	/SCREEN ADDR
	DAC	ERA
	TAD	(-2
	JMS*	.SP	/PRINT MES.
ERA	0
ERN	0
	0
	LAW	40
	LAW	40
	LAW	100
	LAW	40
	JMS*	.ER
ERC	400000		/OTS CODE
	JMP*	ERP
.RE=ERP
/
	.END
