运算偏差
编了一个材积计算的程序,但结果果有偏差,4M,20CM的材种是0.16,计算得出是0.152。请帮一帮。源代码如下 :
local ll as numeric ,dd as numeric,nn as numeric,v1 as numeric,vv11 as numeric,vv1 as numeric,vv as numeric,cai as numeric
SET DECIMALS TO 4
SET FIXED ON
ll=thisform.text1.value
dd=thisform.text2.value
nn=thisform.text3.value
IF ll<10.1
IF dd>12
vv1=1000*0.000125*ll*(14-ll)*(14-ll)*(dd-10)
vv11=round(vv1,3)
v1=dd+0.5*ll+0.005*ll*ll+vv11/1000
vv=7854*ll*v1*v1/100000000
cai=nn*(int(vv*1000+0.5))/1000
thisform.text4.value =cai
ELSE
IF dd>7
v1=dd+0.45*ll+0.2
vv=0.7854*ll*v1*v1/10000
cai=nn*(int(vv*1000+0.5))/1000
thisform.text4.value =cai
ENDIF
ENDIF
v1=dd+0.45*ll+0.2
vv=0.7854*ll*v1*v1/10000
ELSE
IF dd>7
v1=dd+0.5*ll
vv=0.8*ll*v1*v1/10000
cai=nn*(int(vv*1000+0.5))/1000
thisform.text4.value =cai
ELSE
v1=dd+0.5*ll
vv=0.8*ll*v1*v1/10000
ENDIF
ENDIF
cai=nn*(int(vv*10000+0.5))/10000
thisform.text4.value =cai