Search code examples
vbabasic

lg Function in Visual Basic


this is an very odd question.

I have a client, which needs an updated version of his program. He gave me all the old files, told me it was an Visual Basic Program, from 1995.

As I am born in 2002, I did not realize that Visual Basic did not even exist back then.

Anyway, the syntax seems to be the same

VERSION 2.00
Begin Form REDACTED 
   BackColor       =   &H00C0C0C0&

...

Dim ja
Dim lwi1(6) As Double
Dim lwaa(6) As Double
Dim lwa(6) As Double
Dim rr(6) As Double

Then I saw the following line

zwert1 = lg(1# - x) / lg(1# - xcr)

And tried to find the documentation for lg().

After searching for about an hour I gave up. I think its log(), but im not sure, and also I'm confused what kind of language this is written in, there are some PowerPascal (??) files dated in 1989, and the filetype of the cited code is '.frm'.

I feel like I am in a museum, without documentation or a guide.

Can anyone help me figure out what language this is, and what lg() achieves?


Solution

  • It probably is log10 of Visual Basic 4: Logarithm(log, lg, ln)

    Here's a substitute for VBA:

    Public Function Log10( _
        ByVal Value As Double) _
        As Double
    
    ' Returns Log 10 of Value.
    ' 2015-08-17. Gustav Brock, Cactus Data ApS, CPH.
    
        Const Base10    As Double = 10
    
        ' No error handling as this should be handled
        ' outside this function.
        '
        ' Example:
        '
        '     If MyValue > 0 then
        '         LogMyValue = Log10(MyValue)
        '     Else
        '         ' Do something else ...
        '     End If
        
        Log10 = Log(Value) / Log(Base10)
    
    End Function