xref: /original-bsd/old/libm/liboldnm/sinh.s (revision 4d1ce0b0)
1#
2# Copyright (c) 1980 Regents of the University of California.
3# All rights reserved.  The Berkeley software License Agreement
4# specifies the terms and conditions for redistribution.
5#
6#	@(#)sinh.s	5.1 (Berkeley) 05/08/85
7#
8#
9# double _sinh(arg)
10# double _cosh(arg)
11# double arg
12# method: compute from exp except for sinh where -.5<arg<.5
13# then a polynimial approx. is uded
14# JF Jarvis, August 12,1978
15.globl _sinh
16.globl _cosh
17.globl _exp
18.text
19.align 1
20_sinh:
21	.word	0x0c0
22	bispsw	$0xe0
23	movd	4(ap),r6
24	cmpd	r6,$0d0.5e+0
25	jgeq	expfrm
26	cmpd	r6,$0d-0.5e+0
27	jleq	expfrm
28	muld3	r6,r6,r0	# Hart&Cheney SINH 1985
29	polyd	r0,$5,pcoef
30	muld2	r6,r0
31	ret
32expfrm:
33	movd	r6,-(sp)	# sinh(x)=(exp(x)-exp(-x))/2
34	calls	$2,_exp
35	divd3	r0,$0d1.0e+0,r2
36	subd2	r2,r0
37	muld2	$0d0.5e+0,r0
38	ret
39.align 1
40_cosh:
41	.word	0x0
42	bispsw	$0xe0
43	movd	4(ap),-(sp)
44	calls	$2,_exp
45	divd3	r0,$0d1.0e+0,r2
46	addd2	r2,r0
47	muld2	$0d0.5e+0,r0
48	ret
49.data
50.align	2
51pcoef:
52	.double 0d0.251726188251e-7
53	.double 0d0.275569807356154e-5
54	.double 0d0.1984127027907999e-3
55	.double 0d0.833333333307759961e-2
56	.double 0d0.16666666666667212324e+0
57	.double 0d0.99999999999999998116e+0
58