Results 1 to 5 of 5

Thread: Log (base10) conversion - VB6

  1. #1

    Thread Starter
    Lively Member Steve Cain's Avatar
    Join Date
    Sep 2000
    Location
    Wiltshire, UK
    Posts
    105

    Question Log (base10) conversion - VB6

    I need to create a couple of functions in VB. One to return the log(10) of a number and one to do the reverse, convert the ani-log back again.

    If anyone can help would be much appreciated.

    Thanks.

  2. #2
    Member
    Join Date
    Apr 2001
    Location
    Emden, Germany
    Posts
    63
    ok, here's how to calculate log10 from natural log

    Log10 = Log(value) / Log(10)

    the opposite way around:

    10^value
    WIN 2000 Prof. / WIN 98 / WIN 95, IE6.0, Mathematica 4.0
    Visual Studio Enterprise 6.0 sp5

  3. #3
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Damn beat me!
    VB Code:
    1. Private Sub Command1_Click()
    2.     x = 100000
    3.     Label1 = Log(x) / Log(10)
    4.    
    5.     y = Val(Label1.Caption)
    6.     Label2 = 10 ^ y
    7. End Sub
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  4. #4

    Thread Starter
    Lively Member Steve Cain's Avatar
    Join Date
    Sep 2000
    Location
    Wiltshire, UK
    Posts
    105
    Thanks to all.

    Regards,

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    replace log(10) with 2.30258509299405
    since that's a totally unnessesary computation
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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