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: #	@(#)badtan.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    $0d1.7e+38,r0
  35:         jmp     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: pcoef:
  54:         .double 0d0.33866386426771720960e-4
  55:         .double 0d0.34225543872410034353e-1
  56:         .double 0d-0.15506856534832663769e+2
  57:         .double 0d0.10559709017149531936e+4
  58:         .double 0d-0.13068202647548256682e+5
  59: qcoef:
  60:         .double 0d1.0e+0
  61:         .double 0d-0.15550331640317099669e+3
  62:         .double 0d0.47657513629164836989e+4
  63:         .double 0d-0.16638952389471190018e+5
  64: fopi:
  65:         .double 0d1.27323954473516268e+0
  66: fopix: .byte 0x29

Defined functions

_tan declared in line 13; defined in line 16; used 11 times
a0 defined in line 28; used 4 times
  • in line 28(4)
a1 defined in line 41; used 1 times
  • in line 28
a2 defined in line 29; used 1 times
  • in line 28
a3 defined in line 31; used 1 times
  • in line 28
a4 defined in line 39; used 1 times
  • in line 28
b1 defined in line 32; used 1 times
  • in line 30
b2 defined in line 36; used 1 times
  • in line 33
b3 defined in line 37; used 1 times
  • in line 35
c1 defined in line 24; used 1 times
  • in line 21
rtan defined in line 44; used 2 times

Defined variables

fopi defined in line 64; used 1 times
  • in line 25
fopix defined in line 66; used 1 times
  • in line 25
pcoef defined in line 53; used 1 times
  • in line 46
qcoef defined in line 59; used 1 times
  • in line 48
Last modified: 1985-05-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1015
Valid CSS Valid XHTML 1.0 Strict