/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
Logaritme
Fra : Neo


Dato : 18-09-03 13:38

Hej Alle

Jeg undrer mig over følgende !

Visual basic 6:

Private Sub Command1_Click()

MsgBox Log(50)

End Sub

Hvis jeg trykker på command1 så popper msgbox op med resultat = 3,912

Men hvis jeg beregner logaritmen af 50 ( log(50) ) på en lommeregner får jeg
resultatet = 1,6989

Det er helt klart VB6 der beregner "forkert" .... men hvorfor ?

..
..

eller er det bare mig der griber det helt forkert an ?

Mvh Neo



 
 
Troels Thomsen (18-09-2003)
Kommentar
Fra : Troels Thomsen


Dato : 18-09-03 14:02

>
> Hvis jeg trykker på command1 så popper msgbox op med resultat = 3,912
>
> Men hvis jeg beregner logaritmen af 50 ( log(50) ) på en lommeregner får
jeg
> resultatet = 1,6989
>

Der er forskel på 10 tals logaritme og naturlig logaritme.
Fra hjælpen:

Log Function

Returns a Double specifying the natural logarithm of a number.
<cut>
You can calculate base-n logarithms for any number x by dividing the natural
logarithm of x by the natural logarithm of n as follows:

Logn(x) = Log(x) / Log(n)

The following example illustrates a custom Function that calculates base-10
logarithms:

Static Function Log10(X)
Log10 = Log(X) / Log(10#)
End Function

mvh Troels



Neo (19-09-2003)
Kommentar
Fra : Neo


Dato : 19-09-03 09:08

<snip>

> Der er forskel på 10 tals logaritme og naturlig logaritme.
> Fra hjælpen:
>
> Log Function
>
> Returns a Double specifying the natural logarithm of a number.
> <cut>
> You can calculate base-n logarithms for any number x by dividing the
natural
> logarithm of x by the natural logarithm of n as follows:
>
> Logn(x) = Log(x) / Log(n)
>
> The following example illustrates a custom Function that calculates
base-10
> logarithms:
>
> Static Function Log10(X)
> Log10 = Log(X) / Log(10#)
> End Function
>
> mvh Troels
>
>

Nå .... tjaa hvad ved bønder om kartoffelsalat .... ... tak for hjælpen
!

Neo



Søg
Reklame
Statistik
Spørgsmål : 177459
Tips : 31964
Nyheder : 719565
Indlæg : 6408195
Brugere : 218881

Månedens bedste
Årets bedste
Sidste års bedste