- Public Function ZLog10(X) As Double
- Dim Wi As Integer
- Dim N, N1, N2, N3 As Double
- Dim P As Integer
- Dim Sg As Boolean
- Sg = True
- If X <= 0 Then
- xx = MsgBox("Valeur négative ou nulle interdite", vbCritical, "Calcul du Log")
- Exit Function
- End If
-
- If X < 1 And X > 0 Then
- X = 1 / X
- Sg = False
- End If
-
- N1 = X
- P = 0
- N2 = 0
- N3 = 1
- While P < 16
- Wi = 0
- N = N1
- While N >= 10
- N = N / 10
- Wi = Wi + 1
- Wend
- N1 = N * N
- N1 = N1 * N1
- N1 = N1 * N
- N1 = N1 * N1
- N2 = N2 + Wi / N3
- P = P + 1
- N3 = N3 * 10
- Wend
- If Not Sg Then
- N2 = -N2
- End If
-
- ZLog10 = N2
- End Function
-
- Public Function ZLog2(X) As Double
- Dim Wi, Wj, Wk, Wl As Integer
- Dim N, N1, N2, N3 As Double
- Dim P As Integer
- Dim Sg As Boolean
- 'log(2)=0.693147180559945309417232121458176568075500134360255254120678
- Dim WLOG2 As Double
- WLOG2 = 0.693147180559945
- Sg = True
- If X <= 0 Then
- xx = MsgBox("Valeur négative ou nulle interdite", vbCritical, "Calcul du Log")
- Exit Function
- End If
-
- If X < 1 And X > 0 Then
- X = 1 / X
- Sg = False
- End If
-
- N1 = X
- P = 0
- N2 = 0
- N3 = 1
- While P < 60
- Wi = 0
- N = N1
- While N >= 2
- N = N / 2
- Wi = Wi + 1
- Wend
- N1 = N * N
- N2 = N2 + Wi / N3
- P = P + 1
- N3 = N3 * 2
- Wend
- If Not Sg Then
- N2 = -N2
- End If
-
- ZLog2 = N2 * WLOG2
- End Function
-
Public Function ZLog10(X) As Double
Dim Wi As Integer
Dim N, N1, N2, N3 As Double
Dim P As Integer
Dim Sg As Boolean
Sg = True
If X <= 0 Then
xx = MsgBox("Valeur négative ou nulle interdite", vbCritical, "Calcul du Log")
Exit Function
End If
If X < 1 And X > 0 Then
X = 1 / X
Sg = False
End If
N1 = X
P = 0
N2 = 0
N3 = 1
While P < 16
Wi = 0
N = N1
While N >= 10
N = N / 10
Wi = Wi + 1
Wend
N1 = N * N
N1 = N1 * N1
N1 = N1 * N
N1 = N1 * N1
N2 = N2 + Wi / N3
P = P + 1
N3 = N3 * 10
Wend
If Not Sg Then
N2 = -N2
End If
ZLog10 = N2
End Function
Public Function ZLog2(X) As Double
Dim Wi, Wj, Wk, Wl As Integer
Dim N, N1, N2, N3 As Double
Dim P As Integer
Dim Sg As Boolean
'log(2)=0.693147180559945309417232121458176568075500134360255254120678
Dim WLOG2 As Double
WLOG2 = 0.693147180559945
Sg = True
If X <= 0 Then
xx = MsgBox("Valeur négative ou nulle interdite", vbCritical, "Calcul du Log")
Exit Function
End If
If X < 1 And X > 0 Then
X = 1 / X
Sg = False
End If
N1 = X
P = 0
N2 = 0
N3 = 1
While P < 60
Wi = 0
N = N1
While N >= 2
N = N / 2
Wi = Wi + 1
Wend
N1 = N * N
N2 = N2 + Wi / N3
P = P + 1
N3 = N3 * 2
Wend
If Not Sg Then
N2 = -N2
End If
ZLog2 = N2 * WLOG2
End Function