Excel在水文要素计算中的应用(2)
2013-09-09 01:04
导读:Temp1=.Round(Abs(num),-(Int(.Log(Abs(num)))-DIG+1)) Temp1=Temp1-Tempoff Trn=TrnAnd(10^Int(.Log(Temp1))=Temp1AndTemp1Abs(num)) IfDIG14AndTrnThen Temp2=有效位数不能太多 GoToExitFn EndIf IfDIG=1A
Temp1 = .Round(Abs(num), -(Int(.Log(Abs(num))) - DIG + 1))
Temp1 = Temp1 - Tempoff
Trn = Trn And (10 ^ Int(.Log(Temp1)) = Temp1 And Temp1 > Abs(num))
If DIG > 14 And Trn Then
Temp2 = "有效位数不能太多"
GoTo ExitFn
End If
If DIG = 1 And Int(.Log(Abs(Temp1))) = 0 And Not Trn Then
TFM = ""
Else
If Not (DIG = 1 And Int(Temp1) = Temp1 And Not Trn) Then TFM = TFM & "."
TFM = TFM & .Rept("0", DIG + Abs(Trn) - 1)
End If
TFM = "0" & TFM
If Int(.Log(Temp1)) < 0 Then
TFM = TFM & .Rept("0", -Int(.Log(Temp1)))
ElseIf Int(.Log(Temp1)) > 0 Then
TFM = TFM & "E+###"
End If