Visual Basic 中的 lg 函数

问题描述

这是一个很奇怪的问题。

我有一个客户,需要更新版本的程序。他给了我所有的旧文件,告诉我这是 1995 年的 Visual Basic 程序。

我出生于 2002 年,当时我没有意识到 Visual Basic 甚至不存在。

反正语法好像是一样的

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

然后我看到了下面这行

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

并试图找到 lg() 的文档。

搜索了大约一个小时后,我放弃了。我认为它是 log(),但我不确定,而且我很困惑这是用哪种语言编写的,有一些 PowerPascal (??) 文件的日期为 1989 年,引用代码文件类型是'.frm'

我感觉就像在博物馆里,没有文件或指南。

谁能帮我弄清楚这是什么语言,以及 lg() 实现了什么?

解决方法

它可能是 Visual Basic 4 的 log10Logarithm(log,lg,ln)

这是 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