1: .globl exp, _exp
   2: /
   3: ldfps = 170100^tst
   4: stfps = 170200^tst
   5: ldexp = 176400^movif
   6: stexp = 175000^movfi
   7: /
   8: /	exp accepts its argument and returns its result
   9: /	in fr0.  The carry bit is set if the result overflows.
  10: /	The coefficients are #1067 from Hart & Cheney.
  11: /
  12: /	movf	arg,fr0
  13: /	jsr	pc,exp
  14: /	movf	fr0,result
  15: /
  16: _exp:
  17:         mov     r5,-(sp)
  18:         mov     sp,r5
  19:         mov     4(r5),fr0
  20:         jsr     pc,exp
  21:         mov     (sp)+,r5
  22:         rts     pc
  23: 
  24: exp:
  25:         stfps   -(sp)
  26:         ldfps   $200            /di mode
  27:         movf    fr2,-(sp)
  28:         movf    fr1,-(sp)
  29:         tstf    fr0
  30:         cfcc
  31:         bne     1f
  32:         movf    $one,fr0        /exp(0)
  33:         clc
  34:         br      out
  35: 1:
  36:         modf    log2e,fr0       /exp(x) = 2^(x*log2(e))
  37:         cfcc
  38:         bmi     2f
  39:         movfi   fr1,-(sp)       /save integer part
  40:         subf    $half,fr0
  41:         br      3f
  42: 2:
  43:         movfi   fr1,-(sp)
  44:         dec     (sp)
  45:         addf    $half,fr0
  46: 3:
  47:         movf    fr0,fr1         / -.5 < x < +.5
  48:         mulf    fr1,fr1         /arg**2
  49: /
  50:         movf    P2,fr2
  51:         mulf    fr1,fr2
  52:         addf    P1,fr2
  53:         mulf    fr1,fr2
  54:         addf    P0,fr2
  55:         mulf    fr2,fr0         /xP(x**2)
  56: /
  57:         movf    fr1,fr2
  58:         addf    Q1,fr2
  59:         mulf    fr1,fr2
  60:         addf    Q0,fr2          /Q(x**2)
  61: /
  62:         movf    fr2,fr1
  63:         subf    fr0,fr1
  64:         addf    fr2,fr0
  65:         divf    fr1,fr0         /(Q+xP)/(Q-xP)
  66:         mulf    sqrt2,fr0
  67: /
  68:         stexp   fr0,-(sp)
  69:         add     (sp)+,(sp)
  70: /
  71:         cmp     (sp),$177
  72:         ble     2f
  73:         tst     (sp)+
  74:         movf    big,fr0         /overflow
  75:         sec
  76:         br      1f
  77: 2:
  78:         cmp     (sp),$-177
  79:         bge     2f
  80:         tst     (sp)+
  81:         clrf    fr0             /underflow
  82:         clc
  83:         br      1f
  84: 2:
  85:         ldexp   (sp)+,fr0
  86:         clc
  87: 1:
  88: out:
  89:         movf    (sp)+,fr1
  90:         movf    (sp)+,fr2
  91:         ldfps   (sp)+
  92:         rts     pc
  93: /
  94: /
  95:         .data
  96: P0:      42675;  36404;  77563;  46675
  97: P1:      41241; 116724; 114237;  60333
  98: P2:      36675;  27102; 125560; 136652
  99: Q0:      43210; 100661;  76072;  62453
 100: Q1:      42151;  27450;  75350; 112503
 101: log2e:   40270; 125073;  24534;  13761
 102: sqrt2:   40265;  02363;  31771; 157144
 103: half    = 40000
 104: one     = 40200
 105: /
 106: big:     77777; 177777; 177777; 177777
 107: /
 108: / P0 = .15139 06799 05433 89158 94328 d4
 109: / P1 = .20202 06565 12869 27227 886   d2
 110: / P2 = .23093 34775 37502 33624       d-1
 111: /
 112: / Q0 = .43682 11662 72755 84984 96814 d4
 113: / Q1 = .23318 42114 27481 62379 0295  d3
 114: / Q2 = .1                             d1
 115: /
 116: / log2e = 1.44269 50408 88963 40735 99246
 117: / sqrt2 = 1.41421 35623 73095 04880 16887

Defined functions

_exp declared in line 1; defined in line 16; used 3 times
exp declared in line 1; defined in line 24; used 12 times
ldexp defined in line 5; used 1 times
  • in line 85
out defined in line 88; used 1 times
  • in line 34
stexp defined in line 6; used 1 times
  • in line 68

Defined variables

P0 defined in line 96; used 1 times
  • in line 54
P1 defined in line 97; used 1 times
  • in line 52
P2 defined in line 98; used 1 times
  • in line 50
Q0 defined in line 99; used 1 times
  • in line 60
Q1 defined in line 100; used 1 times
  • in line 58
big defined in line 106; used 1 times
  • in line 74
half defined in line 103; used 2 times
log2e defined in line 101; used 1 times
  • in line 36
one defined in line 104; used 1 times
  • in line 32
sqrt2 defined in line 102; used 1 times
  • in line 66
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 693
Valid CSS Valid XHTML 1.0 Strict