	function qseval(x, y, a, b, n, t)
	dimension x(n),y(n),a(n),b(n)
	data i/1/
	save i
!
!	quadratic spline evaluation
!
	if(t<x(1).or.t>x(n)) stop 't out of range'
	if( .not.(x(i)<t.and.t<x(i+1)) )then	!last i is still valid?
		i=1
		j=n
		do while(j-i>1)				! binary search
			k=(i+j)/2
			if(t>x(k))then
				i=k
			else
				j=k
			end if
		end do
	end if
	dx=t-x(i)
	qseval=y(i)+dx*(a(i)+dx*b(i))
	return
	end
