                                            
/exponential subroutine

/call with binary point between bits 5 and 6 of AC. Returns integer.

exp,	0		/exp e
	dap xpx
	lac exp
	lio (161251	/(log2 e)-1
	jda hsm
	add exp
	dac xp2
	jmp xp

xp2,	0		/exp 2
	dap xpx
	lac xp2
xp,	spa
	jmp xpx
	add (170000
	spa
	jmp xpx
	law i 7777
	and xp2
	dac sh.c		/high bits
	xor xp2
	ral 4s
	dac .f		/fraction
	load exp, 200001
	dzm .ct
	jmp r

lp,	lac f
g1,	sub .
	sma
	jmp fle

r,	idx ct
	add (c-1
	dap g1
	sas (c+7
	jmp lp

a,	lac f
	lio (261344	/ln 2
	jda hsm
	add (200001
	lio exp
	jda hsm
	ral 1s
	swap
	lac shc
	sub (210000
	jmp s2
           
                             
s1,	sir 1s
s2,	add (10000
	spa
	jmp s1
	swap
xpx,	jmp .

fle,	dac f
	lac ct
	lio exp
fl1,	sir 1s
	sub (1
	sza
	jmp fl1
	swap
	add exp
	dac exp
	jmp r

c,	112700		/log (1+2^(-n))
	51151
	25601
	13144
	5536
	2672
	1340

hsm,	0
	dap hsx
	cla
	repeat 21, mus hsm
hsx,	jmp .
           

start
           
             
                                                               
