|
|
1.1 root 1: # double tan(arg)
2: # double arg;
3: #method: range reduction to [0,pi/4] followed by polynomial
4: # approximation: Hart&Cheney TAN 4285 D=19.74
5: .globl _tan
6: .text
7: .align 1
8: _tan:
9: .word 0x07c0
10: bispsw $0xe0
11: clrl r10 # sign flag, !=0 negate result
12: movd 4(ap),r0
13: jgeq c1
14: xorw2 $0x8000,r10
15: mnegd r0,r0
16: c1:
17: emodd fopi,fopix,r0,r2,r6
18: bicl2 $~3,r2
19: caseb r2,$0,$3
20: a0: .word a1-a0,a2-a0,a3-a0,a4-a0
21: a2: subd3 r6,$0d1.0e+0,r6
22: jbr b1
23: a3: xorw2 $0x8000,r10
24: b1: bsbb rtan
25: jneq b2 # tests final result cmptd in rtan
26: movd $0d1.7e+38,r0
27: jmp b3
28: b2: divd3 r0,$0d1.0e+0,r0
29: b3: xorw2 r10,r0 # negate result if flag != 0
30: ret
31: a4: subd3 r6,$0d1.0e+0,r6
32: xorw2 $0x8000,r10
33: a1: bsbb rtan
34: xorw2 r10,r0
35: ret
36: rtan:
37: muld3 r6,r6,r8
38: polyd r8,$4,pcoef
39: muld2 r0,r6
40: polyd r8,$3,qcoef
41: divd3 r0,r6,r0
42: rsb
43: .data
44: .align 2
45: pcoef:
46: .double 0d0.33866386426771720960e-4
47: .double 0d0.34225543872410034353e-1
48: .double 0d-0.15506856534832663769e+2
49: .double 0d0.10559709017149531936e+4
50: .double 0d-0.13068202647548256682e+5
51: qcoef:
52: .double 0d1.0e+0
53: .double 0d-0.15550331640317099669e+3
54: .double 0d0.47657513629164836989e+4
55: .double 0d-0.16638952389471190018e+5
56: fopi:
57: .double 0d1.27323954473516268e+0
58: fopix: .byte 0x29
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.