Annotation of 42BSD/usr.lib/libnm/atan.s, revision 1.1.1.1

1.1       root        1: # double atan(arg1); -pi/2 < atan < pi/2
                      2: #double atan2(arg1,arg2); -pi< atan2<pi
                      3: #double arg1,arg2
                      4: #method: range reduction to [sqrt(2)-1,sqrt(2)+1]
                      5: # followed by Hart&Cheney ARCTN 5076 D=17.55
                      6: # J. F. Jarvis August 8, 1978
                      7: .globl _atan
                      8: .globl _atan2
                      9: .text
                     10: .align 1
                     11: _atan:
                     12:        .word   0x03c0
                     13:        bispsw  $0xe0
                     14:        movd    4(ap),r0
                     15:        jgtr    a1
                     16:        mnegd   r0,r0   # atan(arg1), arg1<0
                     17:        bsbb    satan
                     18:        mnegd   r0,r0
                     19:        ret
                     20: a1:    bsbb    satan   # atan(arg1), arg1>=0
                     21:        ret
                     22: #
                     23: .align 1
                     24: _atan2:
                     25:        .word   0x03c0
                     26:        bispsw  $0xe0
                     27:        movd    4(ap),r0        # atan(arg1/arg2)
                     28:        movd    12(ap),r2
                     29:        addd3   r0,r2,r4
                     30:        cmpd    r0,r4
                     31:        jneq    b1
                     32:        tstd    r0
                     33:        jgeq    b2
                     34:        mnegd   pio2,r0
                     35:        ret
                     36: b2:    movd    pio2,r0
                     37:        ret
                     38: #
                     39: b1:    tstd    r2
                     40:        jgeq    b3
                     41:        divd2   r2,r0
                     42:        jleq    b4
                     43:        bsbb    satan   # arg1<0, arg2<0
                     44:        subd2   pi,r0
                     45:        ret
                     46: b4:    mnegd   r0,r0   # arg1>0, arg2<0
                     47:        bsbb    satan
                     48:        subd3   r0,pi,r0
                     49:        ret
                     50: #
                     51: b3:    divd2   r2,r0
                     52:        jleq    b5
                     53:        bsbb    satan   # arg1>0, arg2>0
                     54:        ret
                     55: b5:    mnegd   r0,r0   # arg1<0, arg2>0
                     56:        bsbb    satan
                     57:        mnegd   r0,r0
                     58:        ret
                     59: #
                     60: .globl satan
                     61: satan: # range reduction on positive arg(r0)
                     62:        cmpd    r0,sq2m1
                     63:        jgeq    c1
                     64:        bsbb    xatan
                     65:        rsb
                     66: c1:    cmpd    r0,sq2p1
                     67:        jleq    c2
                     68:        divd3   r0,$0d1.0e+0,r0
                     69:        bsbb    xatan
                     70:        subd3   r0,pio2,r0
                     71:        rsb
                     72: c2:    addd3   $0d1.0e+0,r0,r2
                     73:        subd2   $0d1.0e+0,r0
                     74:        divd2   r2,r0
                     75:        bsbb    xatan
                     76:        addd2   pio4,r0
                     77:        rsb
                     78: #
                     79: xatan: # compute arctan(r0) for:sqrt(2)-1<r0<sqrt(2)+1
                     80: # Hart&Cheney ARCTN 5076 is evaluated
                     81:        movd    r0,r8
                     82:        muld3   r0,r0,r6
                     83:        polyd   r6,$4,pcoef
                     84:        muld2   r0,r8
                     85:        polyd   r6,$4,qcoef
                     86:        divd3   r0,r8,r0
                     87:        rsb
                     88: .data
                     89: .align 2
                     90: pcoef:
                     91:        .double 0d0.1589740288482307048e+0
                     92:        .double 0d0.66605790170092626575e+1
                     93:        .double 0d0.40969264832102256374e+2
                     94:        .double 0d0.77477687719204208616e+2
                     95:        .double 0d0.44541340059290680319e+2
                     96: qcoef:
                     97:        .double 0d1.0e+0
                     98:        .double 0d0.15503977551421987525e+2
                     99:        .double 0d0.62835930511032376833e+2
                    100:        .double 0d0.92324801072300974840e+2
                    101:        .double 0d0.44541340059290680444e+2
                    102: pio4: .double  0d0.78539816339744830961e+0
                    103: pio2: .double  0d1.57079632679489661923e+0
                    104: sq2p1: .double 0d2.41421356237309504880e+0
                    105: sq2m1: .double 0d0.41421356237309504880e+0
                    106: pi: .double 0d3.14159265358979323846e+0

unix.superglobalmegacorp.com

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