1# Copyright (c) 1985, 1993 2# The Regents of the University of California. All rights reserved. 3# 4# %sccs.include.redist.sh% 5# 6# @(#)sincos.s 8.1 (Berkeley) 06/04/93 7# 8 .data 9 .align 2 10_sccsid: 11.asciz "@(#)sincos.s 1.1 (Berkeley) 8/21/85; 8.1 (ucb.elefunt) 06/04/93" 12 13# This is the implementation of Peter Tang's double precision 14# sine and cosine for the VAX using Bob Corbett's argument reduction. 15# 16# Notes: 17# under 1,024,000 random arguments testing on [0,2*pi] 18# sin() observed maximum error = 0.814 ulps 19# cos() observed maximum error = 0.792 ulps 20# 21# double sin(arg) 22# double arg; 23# method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett 24# S. McDonald, April 4, 1985 25# 26 .globl _sin 27 .text 28 .align 1 29 30_sin: .word 0xffc # save r2-r11 31 movq 4(ap),r0 32 bicw3 $0x807f,r0,r2 33 beql 1f # if x is zero or reserved operand then return x 34# 35# Save the PSL's IV & FU bits on the stack. 36# 37 movpsl r2 38 bicw3 $0xff9f,r2,-(sp) 39# 40# Clear the IV & FU bits. 41# 42 bicpsw $0x0060 43# 44# Entered by sine ; save 0 in r4 . 45# 46 jsb libm$argred 47 movl $0,r4 48 jsb libm$sincos 49 bispsw (sp)+ 501: ret 51 52# 53# double cos(arg) 54# double arg; 55# method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett 56# S. McDonald, April 4, 1985 57# 58 .globl _cos 59 .text 60 .align 1 61 62_cos: .word 0xffc # save r2-r11 63 movq 4(ap),r0 64 bicw3 $0x7f,r0,r2 65 cmpw $0x8000,r2 66 beql 1f # if x is reserved operand then return x 67# 68# Save the PSL's IV & FU bits on the stack. 69# 70 movpsl r2 71 bicw3 $0xff9f,r2,-(sp) 72# 73# Clear the IV & FU bits. 74# 75 bicpsw $0x0060 76# 77# Entered by cosine ; save 1 in r4 . 78# 79 jsb libm$argred 80 movl $1,r4 81 jsb libm$sincos 82 bispsw (sp)+ 831: ret 84