|
|
1.1 ! root 1: # Copyright (c) 1985 Regents of the University of California. ! 2: # All rights reserved. ! 3: # ! 4: # Redistribution and use in source and binary forms are permitted ! 5: # provided that the above copyright notice and this paragraph are ! 6: # duplicated in all such forms and that any documentation, ! 7: # advertising materials, and other materials related to such ! 8: # distribution and use acknowledge that the software was developed ! 9: # by the University of California, Berkeley. The name of the ! 10: # University may not be used to endorse or promote products derived ! 11: # from this software without specific prior written permission. ! 12: # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 13: # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 14: # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 15: # ! 16: # All recipients should regard themselves as participants in an ongoing ! 17: # research project and hence should feel obligated to report their ! 18: # experiences (good or bad) with these elementary function codes, using ! 19: # the sendbug(8) program, to the authors. ! 20: # ! 21: # @(#)sincos.s 5.3 (Berkeley) 6/30/88 ! 22: # ! 23: .data ! 24: .align 2 ! 25: _sccsid: ! 26: .asciz "@(#)sincos.s 1.1 (Berkeley) 8/21/85; 5.3 (ucb.elefunt) 6/30/88" ! 27: ! 28: # This is the implementation of Peter Tang's double precision ! 29: # sine and cosine for the VAX using Bob Corbett's argument reduction. ! 30: # ! 31: # Notes: ! 32: # under 1,024,000 random arguments testing on [0,2*pi] ! 33: # sin() observed maximum error = 0.814 ulps ! 34: # cos() observed maximum error = 0.792 ulps ! 35: # ! 36: # double sin(arg) ! 37: # double arg; ! 38: # method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett ! 39: # S. McDonald, April 4, 1985 ! 40: # ! 41: .globl _sin ! 42: .text ! 43: .align 1 ! 44: ! 45: _sin: .word 0xffc # save r2-r11 ! 46: movq 4(ap),r0 ! 47: bicw3 $0x807f,r0,r2 ! 48: beql 1f # if x is zero or reserved operand then return x ! 49: # ! 50: # Save the PSL's IV & FU bits on the stack. ! 51: # ! 52: movpsl r2 ! 53: bicw3 $0xff9f,r2,-(sp) ! 54: # ! 55: # Clear the IV & FU bits. ! 56: # ! 57: bicpsw $0x0060 ! 58: # ! 59: # Entered by sine ; save 0 in r4 . ! 60: # ! 61: jsb libm$argred ! 62: movl $0,r4 ! 63: jsb libm$sincos ! 64: bispsw (sp)+ ! 65: 1: ret ! 66: ! 67: # ! 68: # double cos(arg) ! 69: # double arg; ! 70: # method: true range reduction to [-pi/4,pi/4], P. Tang & B. Corbett ! 71: # S. McDonald, April 4, 1985 ! 72: # ! 73: .globl _cos ! 74: .text ! 75: .align 1 ! 76: ! 77: _cos: .word 0xffc # save r2-r11 ! 78: movq 4(ap),r0 ! 79: bicw3 $0x7f,r0,r2 ! 80: cmpw $0x8000,r2 ! 81: beql 1f # if x is reserved operand then return x ! 82: # ! 83: # Save the PSL's IV & FU bits on the stack. ! 84: # ! 85: movpsl r2 ! 86: bicw3 $0xff9f,r2,-(sp) ! 87: # ! 88: # Clear the IV & FU bits. ! 89: # ! 90: bicpsw $0x0060 ! 91: # ! 92: # Entered by cosine ; save 1 in r4 . ! 93: # ! 94: jsb libm$argred ! 95: movl $1,r4 ! 96: jsb libm$sincos ! 97: bispsw (sp)+ ! 98: 1: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.