CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Posts
    14

    How can I preform significant figure?

    How can I preform significant figure?


  2. #2
    Join Date
    Sep 1999
    Location
    Leeds U.K. (Proud to be Sheffield Born)
    Posts
    202

    Re: How can I preform significant figure?

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured