File:  [MW Coherent from dump] / coherent / b / lib / libm / i387 / cosh87.s
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

//////////
/ /usr/src/libm/i387/cosh87.s
/ i387 mathematics library
/ cosh(d), sinh(d)
//////////

RASIZE	=	4

	.globl	cosh
	.globl  sinh
	.globl	_exp

//////////
/ double
/ cosh(d)
/ double d;
/
/ double
/ sinh(d)
/ double d;
/
/ cosh(d) = (exp(d) + 1/exp(d))/2
/ sinh(d) = (exp(d) - 1/exp(d))/2
//////////

d	=	RASIZE		/ arg offset

cosh:
	clc			/ Clear Carry to indicate cosh.
	jmp	.L0		/ Go to common code.

sinh:
	stc			/ Set Carry to indicate sinh.

.L0:
	fldl	d(%esp)		/ Load argument d.

	pushf			/ Save the Carry flag.
	call	_exp		/ exp(d)
	fld	%st		/ exp(d), exp(d)
	fld1			/ 1, exp(d), exp(d)
	fdiv	%st, %st(1)	/ 1/exp(d), exp(d)
	popf			/ Restore the flags.
	jnc	?1		/ Jump if cosh.
	fchs			/ -1/exp(d), exp(d) for cosh

?1:
	fadd			/ exp(d) +- 1/exp(d)
	fld1			/ 1, exp(d) +- 1/exp(d)
	fchs			/ -1, exp(d) +- 1/exp(d)
	fxch			/ exp(d) +- 1/exp(d), -1
	fscale			/ (exp(d) +- 1/exp(d)) / 2, -1
	fstp	%st(1)		/ (exp(d) +- 1/exp(d)) / 2
	ret

/ end of cosh87.s

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.