1: #
2: # Copyright (c) 1985 Regents of the University of California.
3: #
4: # Use and reproduction of this software are granted in accordance with
5: # the terms and conditions specified in the Berkeley Software License
6: # Agreement (in particular, this entails acknowledgement of the programs'
7: # source, and inclusion of this notice) with the additional understanding
8: # that all recipients should regard themselves as participants in an
9: # ongoing research project and hence should feel obligated to report
10: # their experiences (good or bad) with these elementary function codes,
11: # using "sendbug 4bsd-bugs@BERKELEY", to the authors.
12: #
13:
14: # @(#)sincos.s 1.1 (Berkeley) 8/21/85
15:
16: # This is the implementation of Peter Tang's double precision
17: # sine and cosine for the VAX using Bob Corbett's argument reduction.
18: #
19: # Notes:
20: # under 1,024,000 random arguments testing on [0,2*pi]
21: # sin() observed maximum error = 0.814 ulps
22: # cos() observed maximum error = 0.792 ulps
23: #
24: # double sin(arg)
25: # double arg;
26: # method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett
27: # S. McDonald, April 4, 1985
28: #
29: .globl _sin
30: .text
31: .align 1
32:
33: _sin: .word 0xffc # save r2-r11
34: movq 4(ap),r0
35: bicw3 $0x807f,r0,r2
36: beql 1f # if x is zero or reserved operand then return x
37: #
38: # Save the PSL's IV & FU bits on the stack.
39: #
40: movpsl r2
41: bicw3 $0xff9f,r2,-(sp)
42: #
43: # Clear the IV & FU bits.
44: #
45: bicpsw $0x0060
46: #
47: # Entered by sine ; save 0 in r4 .
48: #
49: jsb libm$argred
50: movl $0,r4
51: jsb libm$sincos
52: bispsw (sp)+
53: 1: ret
54:
55: #
56: # double cos(arg)
57: # double arg;
58: # method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett
59: # S. McDonald, April 4, 1985
60: #
61: .globl _cos
62: .text
63: .align 1
64:
65: _cos: .word 0xffc # save r2-r11
66: movq 4(ap),r0
67: bicw3 $0x7f,r0,r2
68: cmpw $0x8000,r2
69: beql 1f # if x is reserved operand then return x
70: #
71: # Save the PSL's IV & FU bits on the stack.
72: #
73: movpsl r2
74: bicw3 $0xff9f,r2,-(sp)
75: #
76: # Clear the IV & FU bits.
77: #
78: bicpsw $0x0060
79: #
80: # Entered by cosine ; save 1 in r4 .
81: #
82: jsb libm$argred
83: movl $1,r4
84: jsb libm$sincos
85: bispsw (sp)+
86: 1: ret
Defined functions
_cos
declared in line
61; defined in line
65; used 1 times
_sin
declared in line
29; defined in line
33; used 1 times