|
-
Sep 5th, 2005, 01:24 AM
#1
Thread Starter
Lively Member
[RESOLVED] Log Function
Hi all.
I have some prob with log function.
The code below is not working, it returns a false value.
The value is not same with what I calculate using scientific calculator.
Using my program:
N=2
Na=1
log(N/Na)=0.6931
Using scientific calculator:
N=2
Na=1
log(N/Na)=0.30102999566
VB Code:
Na = 0
temp = 0
temp1 = 0
rs.MoveFirst
Do
For column = 1 To rs.Fields.Count - 1
'If rs.Fields(column) <> Null Then
If Not IsNull(rs.Fields(column).Value) Then
Na = Na + 1
End If
Next column
N = rs.Fields.Count - 1
temp = Log(N / Na)
temp1 = Format(temp, "0.0000")
rs2.AddNew
rs2!Na = temp1
rs2.Update
Na = 0
rs.MoveNext
Loop Until rs.EOF
Last edited by Rina; Sep 5th, 2005 at 01:31 AM.
-
Sep 5th, 2005, 01:52 AM
#2
Re: Log Function
VB has the natural log (e). This is a base 10 log function:
VB Code:
Static Function Log10(X)
Log10 = Log(X) / Log(10#)
End Function
-
Sep 5th, 2005, 01:55 AM
#3
Thread Starter
Lively Member
Re: Log Function
Does this mean I cannot simply use
-
Sep 5th, 2005, 02:18 AM
#4
Re: Log Function
I think you would add the function, and call it like this
-
Sep 5th, 2005, 02:32 AM
#5
Thread Starter
Lively Member
Re: Log Function
Thanks..it works!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|