Click to See Complete Forum and Search --> : How can I preform significant figure?


Kung Wu
February 20th, 2000, 07:40 AM
How can I preform significant figure?

Surrendermonkey
February 22nd, 2000, 05:42 AM
Try this.

private Function SignificantFig(INitialValue as Double, SigFig as Long) as Long
Dim lngtmp as Double, lngtmp2 as Double
lngtmp = 0


lngtmp = CDbl(Log(INitialValue) / Log(10))
lngtmp = Int(lngtmp)
lngtmp2 = INitialValue * 10 ^ (-lngtmp)
' USe "int" with a multiplication here rather than "Round" if you wish to truncate
lngtmp2 = Round(lngtmp2, SigFig - 1)
''''
lngtmp2 = lngtmp2 * 10 ^ lngtmp
SignificantFig = lngtmp2
End Function




Cheers,
surrendermonkey