Another example, now with perspective correction and it still seems to be working:
option explicit
dim as integer i
dim as double u0,u1,z0,z1,du,dy,dz,result
dim as short ptr ui=cast(short ptr,@result)+2
'start and end values
u0=-1234.0
z0=1000.0
u1=10255.0
z1=2000.0
dy=15.0
'add the magic numbers
u0+=1572864.0
u1+=1572864.0
z0=1.0/z0
z1=1.0/z1
u0*=z0
u1*=z1
'interpolate
du=(u1-u0)/dy
dz=(z1-z0)/dy
for i=0 to 15
result=u0/z0
print "my_short=";*ui;" double=";result-1572864.0
u0+=du
z0+=dz
next
sleep
end