大家帮帮忙,帮我翻译一下这段VFP代码
最近做个程序,其中用到一个公式,在网上查的代码是VFP编写的,而我对VFP一窍不通,我需要把它翻译成其它语言,这里的代码如下:
*para u_x1,u_y1,u_x2,u_y2
priv u_dxy,u_x,u_y,u_mx1,u_mx2,u_my1,u_my2,tmpany
if u_x1=0 .and. u_y1=0
u_xy=0
return u_xy
endif
u_dxy=3.141592654 && 圆周率
tmpany=str((u_x1-int(u_x1))*10000,4)
u_mx1=int(u_x1)+(val(left(tmpany,2))/60)+(val(right(tmpany,2))/3600)
tmpany=str((u_y1-int(u_y1))*10000,4)
u_my1=int(u_y1)+(val(left(tmpany,2))/60)+(val(right(tmpany,2))/3600)
tmpany=str((u_x2-int(u_x2))*1000000,6)
u_mx2=int(u_x2)+(val(left(tmpany,2))/60)+(val(substr(tmpany,3,2))/3600)+(val(right(tmpany,2))/360000)
tmpany=str((u_y2-int(u_y2))*1000000,6)
u_my2=int(u_y2)+(val(left(tmpany,2))/60)+(val(substr(tmpany,3,2))/3600)+(val(right(tmpany,2))/360000)
u_x=(round((111.3200144*cos(dtor(u_my1))+111.3200144*cos(dtor(u_my2)))*(u_mx1-u_mx2)/2,7))**2
u_y=(round(110.9481458*(u_my1-u_my2),7))**2
*u_x=((12756.334*u_dxy/360*cos(dtor(u_my1))+12756.334*u_dxy/360*cos(dtor(u_my2)))*(u_mx1-u_mx2)/2)**2
*u_y=(12713.721*u_dxy/360*(u_my1-u_my2))**2
tmpany=round(sqrt(u_x+u_y)*1000,0)
u_xy=iif(tmpany> =9999999,9999999,tmpany)
*u_xy=u_xy/1000
replace sv with u_xy
@ 13, 35 say u_xy
return
我最困惑的是
*u_x=((12756.334*u_dxy/360*cos(dtor(u_my1))+12756.334*u_dxy/360*cos(dtor(u_my2)))*(u_mx1-u_mx2)/2)**2
里的**是什么意思
还有
u_x= ...
*u_x= ...
什么区别
[解决办法]
u_x= ...
*u_x= ...
前面代*表示此行注释掉,即运行时不运行此行
[解决办法]
str(123, 6) 结果是什么
123,前面3个空格,共6位
str函数是将数值转为固定长度的字符串吗?
YES