Annotation of 43BSD/usr.lib/liboldnm/tan.s, revision 1.1.1.1

1.1       root        1: #
                      2: # Copyright (c) 1980 Regents of the University of California.
                      3: # All rights reserved.  The Berkeley software License Agreement
                      4: # specifies the terms and conditions for redistribution.
                      5: #
                      6: #      @(#)tan.s       5.1 (Berkeley) 5/8/85
                      7: # 
                      8: #
                      9: # double tan(arg)
                     10: # double arg;
                     11: #method: range reduction to [0,pi/4] followed by polynomial
                     12: # approximation:  Hart&Cheney TAN 4285 D=19.74
                     13: .globl _tan
                     14: .text
                     15: .align 1
                     16: _tan:
                     17:        .word   0x07c0
                     18:        bispsw  $0xe0
                     19:        clrl    r10     # sign flag, !=0 negate result
                     20:        movd    4(ap),r0
                     21:        jgeq    c1
                     22:        xorw2   $0x8000,r10
                     23:        mnegd   r0,r0
                     24: c1:
                     25:        emodd   fopi,fopix,r0,r2,r6
                     26:        bicl2   $~3,r2
                     27:        caseb   r2,$0,$3
                     28: a0:    .word   a1-a0,a2-a0,a3-a0,a4-a0
                     29: a2:    subd3   r6,$0d1.0e+0,r6
                     30:        jbr     b1
                     31: a3: xorw2      $0x8000,r10
                     32: b1:    bsbb    rtan
                     33:        jneq    b2      # tests final result cmptd in rtan
                     34:        movd    funy,r0
                     35:        jbr     b3
                     36: b2:    divd3   r0,$0d1.0e+0,r0
                     37: b3:    xorw2   r10,r0  # negate result if flag != 0 
                     38:        ret
                     39: a4:    subd3   r6,$0d1.0e+0,r6
                     40:        xorw2   $0x8000,r10
                     41: a1:    bsbb    rtan
                     42:        xorw2   r10,r0
                     43:        ret
                     44: rtan:
                     45:        muld3   r6,r6,r8
                     46:        polyd   r8,$4,pcoef
                     47:        muld2   r0,r6
                     48:        polyd   r8,$3,qcoef
                     49:        divd3   r0,r6,r0
                     50:        rsb
                     51: .data
                     52: .align 2
                     53: funy:  .double 0d1.7e+38
                     54: pcoef:
                     55:        .double 0d0.33866386426771720960e-4
                     56:        .double 0d0.34225543872410034353e-1
                     57:        .double 0d-0.15506856534832663769e+2
                     58:        .double 0d0.10559709017149531936e+4
                     59:        .double 0d-0.13068202647548256682e+5
                     60: qcoef:
                     61:        .double 0d1.0e+0
                     62:        .double 0d-0.15550331640317099669e+3
                     63:        .double 0d0.47657513629164836989e+4
                     64:        .double 0d-0.16638952389471190018e+5
                     65: fopi:
                     66:        .double 0d1.27323954473516268e+0
                     67: fopix: .byte 0x29

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.