VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Finds the logarithim of a number without using the VB log() function

Redsting71  (9 Submissions)   Math/Dates   Visual Basic 5.0   Unknown Difficulty   Wed 17th July 2002   Mon 8th February 2021

Finds the logarithim of a number without using the VB log() function

API Declarations


'Only uses multiplication, division, and exponents to calculate logarithims
'If you care how it works for the example 3 ^ x = 5 (log 5 / log 3, or log 5 base 3)
'In 3 ^ x = 5, it takes the first digit of 5.0000000 (5).
' 1) It sees that 3 ^ 1 is the closest digit to 5 below 5, 3 ^ 2 is higher than it (9 > 5, but 3 < 5)
' 2) It adds 1 to the answer. That is the first digit
' 3)It then gets the second number. It does [5 / (3 ^ 1)] ^ 10, which is rougly 165
' 1a)Then it sees that 3 ^ 4 is the closest number below 165, 4 being the exponent.
' 2a)It adds 4 to the answer, which is now 1.4
' 3a)Then it does [165 / (3 ^ 4)] ^ 10, which is about 2.03. This is about 1188.
' 1b)Now it sees 3 ^ 6 is the lowest number below 1188, 3 ^ 7 is above it. So, it adds 6 to the answer.
' 2b)The answer is now 1.46.
' 3c)Then it does [1188 / (3 ^ 6)] ^ 10, and the process continues.
' .
' .
' .
'END: It solves it for the first 16 digits. The answer is 1.4649735207179, as is given

Rate Finds the logarithim of a number without using the VB log() function (1(1 Vote))
Finds the logarithim of a number without using the VB log() function.bas

Finds the logarithim of a number without using the VB log() function Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters