xref: /csrg-svn/old/libm/liboldnm/badtan.s (revision 20008)
1*20008Sdist#
2*20008Sdist# Copyright (c) 1980 Regents of the University of California.
3*20008Sdist# All rights reserved.  The Berkeley software License Agreement
4*20008Sdist# specifies the terms and conditions for redistribution.
5*20008Sdist#
6*20008Sdist#	@(#)badtan.s	5.1 (Berkeley) 05/08/85
7*20008Sdist#
8*20008Sdist#
920005Sdist# double tan(arg)
1020005Sdist# double arg;
1120005Sdist#method: range reduction to [0,pi/4] followed by polynomial
1220005Sdist# approximation:  Hart&Cheney TAN 4285 D=19.74
1320005Sdist.globl	_tan
1420005Sdist.text
1520005Sdist.align	1
1620005Sdist_tan:
1720005Sdist	.word	0x07c0
1820005Sdist	bispsw	$0xe0
1920005Sdist	clrl	r10	# sign flag, !=0 negate result
2020005Sdist	movd	4(ap),r0
2120005Sdist	jgeq	c1
2220005Sdist	xorw2	$0x8000,r10
2320005Sdist	mnegd	r0,r0
2420005Sdistc1:
2520005Sdist	emodd	fopi,fopix,r0,r2,r6
2620005Sdist	bicl2	$~3,r2
2720005Sdist	caseb	r2,$0,$3
2820005Sdista0:	.word	a1-a0,a2-a0,a3-a0,a4-a0
2920005Sdista2:	subd3	r6,$0d1.0e+0,r6
3020005Sdist	jbr	b1
3120005Sdista3: xorw2	$0x8000,r10
3220005Sdistb1:	bsbb	rtan
3320005Sdist	jneq	b2	# tests final result cmptd in rtan
3420005Sdist	movd	$0d1.7e+38,r0
3520005Sdist	jmp	b3
3620005Sdistb2:	divd3	r0,$0d1.0e+0,r0
3720005Sdistb3:	xorw2	r10,r0	# negate result if flag != 0
3820005Sdist	ret
3920005Sdista4:	subd3	r6,$0d1.0e+0,r6
4020005Sdist	xorw2	$0x8000,r10
4120005Sdista1:	bsbb	rtan
4220005Sdist	xorw2	r10,r0
4320005Sdist	ret
4420005Sdistrtan:
4520005Sdist	muld3	r6,r6,r8
4620005Sdist	polyd	r8,$4,pcoef
4720005Sdist	muld2	r0,r6
4820005Sdist	polyd	r8,$3,qcoef
4920005Sdist	divd3	r0,r6,r0
5020005Sdist	rsb
5120005Sdist.data
5220005Sdist.align	2
5320005Sdistpcoef:
5420005Sdist	.double 0d0.33866386426771720960e-4
5520005Sdist	.double 0d0.34225543872410034353e-1
5620005Sdist	.double 0d-0.15506856534832663769e+2
5720005Sdist	.double 0d0.10559709017149531936e+4
5820005Sdist	.double 0d-0.13068202647548256682e+5
5920005Sdistqcoef:
6020005Sdist	.double 0d1.0e+0
6120005Sdist	.double 0d-0.15550331640317099669e+3
6220005Sdist	.double 0d0.47657513629164836989e+4
6320005Sdist	.double 0d-0.16638952389471190018e+5
6420005Sdistfopi:
6520005Sdist	.double 0d1.27323954473516268e+0
6620005Sdistfopix: .byte 0x29
67