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: #	@(#)exp.s	5.1 (Berkeley) 5/8/85
   7: #
   8: #
   9: # double exp(arg)
  10: # double arg; 0<= arg< 88
  11: # double exp10(arg)
  12: # method: range reduction to [-0.5,0.5], Hart&Chenet EXPB 1067
  13: # J F Jarvis, August 5, 1978
  14: .set    ERANGE,34
  15: .globl  _exp
  16: .globl  _exp10
  17: .globl  _errno
  18: .text
  19: .align  1
  20: _exp10:
  21:         .word   0x07c0
  22:         bispsw  $0xe0
  23:         muld3   4(ap),loge10,r0
  24:         jbr     argtst
  25: .align  1
  26: _exp:
  27:         .word   0x07c0
  28:         bispsw  $0xe0
  29:         movd    4(ap),r0
  30: argtst:
  31:         jnequ   smlarg
  32:         movd    $0d1.0e+0,r0
  33:         ret
  34: smlarg:
  35:         cmpd    r0,minarg
  36:         jgeq    lrgarg
  37:         mnegd   huge,r0
  38:         ret
  39: lrgarg:
  40:         cmpd    r0,maxarg
  41:         jleq    range
  42:         movl    $ERANGE,_errno
  43:         movd    huge,r0
  44:         ret
  45: range:
  46:         emodd   log2e,log2ex,r0,r10,r6  # r10=int(arg), r6=frac(arg)
  47:         tstd    r0
  48:         jgtr    l1
  49:         addd2   $0d0.5e+0,r6
  50:         subw2   $1,r10
  51:         jbr     l2
  52: l1:     subd2   $0d0.5e+0,r6
  53: l2:                     # Hart&Cheney EXPB 1067
  54:         muld3   r6,r6,r8        # range [-.5,.5] D=18.1
  55:         polyd   r8,$2,pcoef
  56:         muld2   r0,r6
  57:         polyd   r8,$2,qcoef
  58:         subd3   r6,r0,r2
  59:         addd2   r6,r0
  60:         divd2   r2,r0
  61:         muld2   sqrt2,r0
  62:         extzv $7,$8,r0,r2
  63:         addl2   r2,r10
  64:         insv    r10,$7,$8,r0    # load correct exponent
  65:         ret
  66: .data
  67: .align  2
  68: pcoef:
  69:         .double 0d0.23093347753750233624e-1
  70:         .double 0d0.20202065651286927227886e+2
  71:         .double 0d0.15139067990543389159e+4
  72: qcoef:
  73:         .double 0d0.1e+1
  74:         .double 0d0.23318421142748162379e+3
  75:         .double 0d0.43682116627275584985e+4
  76: minarg:
  77:         .double 0d-88.028e+0
  78: maxarg:
  79:         .double 0d88.028e+0
  80: huge:   .double 0d1.7e+38
  81: loge10:
  82:         .double 0d2.30258509299404568401e+0
  83: sqrt2:
  84:         .double 0d1.41421356237309504880e+0
  85: log2e:
  86:         .double 0d1.44269504088896340735e+0
  87: log2ex:
  88:         .byte   0xbb

Defined functions

_exp10 declared in line 16; defined in line 20; used 1 times
  • in line 16
argtst defined in line 30; used 1 times
  • in line 24
l1 defined in line 52; used 1 times
  • in line 48
l2 defined in line 53; used 1 times
  • in line 51
lrgarg defined in line 39; used 1 times
  • in line 36
range defined in line 45; used 1 times
  • in line 41
smlarg defined in line 34; used 1 times
  • in line 31

Defined variables

huge defined in line 80; used 2 times
log2e defined in line 85; used 1 times
  • in line 46
log2ex defined in line 87; used 1 times
  • in line 46
loge10 defined in line 81; used 1 times
  • in line 23
maxarg defined in line 78; used 1 times
  • in line 40
minarg defined in line 76; used 1 times
  • in line 35
pcoef defined in line 68; used 1 times
  • in line 55
qcoef defined in line 72; used 1 times
  • in line 57
sqrt2 defined in line 83; used 1 times
  • in line 61
Last modified: 1985-05-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 571
Valid CSS Valid XHTML 1.0 Strict