/
/ VERSION 5A 4-27-77  PT
/
/	C  O  S  H
/	-  -  -  -
/
/SUBROUTINE	COSH(X)
/
/ VERSION 5A 4-27-77  PT
	SECT	COSH
	JA	#COSH
COSHE,	FLDA	COSHB		/GIVE INFINITY IN CASE OF NO REC
	EXTERN	#ARGER
	TRAP4	#ARGER
	TEXT	+COSH  +
COSHXR,	SETX	XRCOSH
	SETB	BPCOSH
BPCOSH,	FNOP
	0
	0
XRCOSH,	F 0.0
COSH7,	F 0.0
COSH8,	F 0.0
F1COSH,	F 1.
F2COSH,	F 2.
	ORG	10*3+BPCOSH
	FNOP
	JA	COSHXR
	0
CSHRTN,	JA	.
/
COSHLG,	0
	2613
	4412
/
COSHB,	3777
	3777
	7777
/
/
COSH1,	F 88.029			/LIMIT FACTOR.
	BASE	0
#COSH,	STARTD
	FLDA	10*3
	FSTA	CSHRTN
	FLDA	0
	SETX	XRCOSH
	SETB	BPCOSH
	BASE	BPCOSH
	LDX	1,1
	FSTA	BPCOSH
	FLDA%	BPCOSH,1	/ADDR OF X
	FSTA	BPCOSH
	STARTF
	FLDA%	BPCOSH	/GET X
	FSTA	COSH8		/SAVE ARGUMENT
	JGE	.+3		/ABS(X)
	FNEG
	FSTA	COSH7
	FSUB	COSH1		/TEST FOR LIMITS.
	JGE	COSHBG
	EXTERN	EXP
	JSR	EXP		/EXP(X)
	JA	.+4
	JA	COSH8
	FSTA	COSH7
	FLDA	F1COSH		/1.
	FDIV	COSH7		/ 1./EXP(X)
	FADD	COSH7		/ EXP(X)+1./EXP(X)
	FDIV	F2COSH		/ (EXP(X)+1./EXP(X))2.
	JA	CSHRTN		/AND THAT IS THE DEFINITION OF COSH.
/
/
COSHBG,	FSUB	COSHLG		/SEE IF TOO BIG
	JGT	COSHE		/YEP. ERROR
	FADD	COSH1		/READD IN SUBTRACTION FACTOR.
	FSTA	COSH8		/ EXP(ABS(X)-LN(2))
	EXTERN	EXP
	JSR	EXP
	JA	.+4
	JA	COSH8
	JA	CSHRTN		/ A VERY GOOD APPROXIMATION.
