Reputation: 13
I write this line in my code:
szo.P_POS = Math.log( ((double) (szo.talalatok_szama_POS_blokkban) / (double)(szo.osszes_talalat_szama)) );
Variables szo.talalatok_szama_POS_blokkban
and szo.osszes_talalat_szama
are int
member of szo inner class
And when I run it, I get different value from the actual value
Example:
System.out.println(Math.log((double)0.6));
this line evaluate to -0.5108256237659907
and actual value is: -0,22184874961635636749123320202039 (Windows Calculator)
Upvotes: 0
Views: 98
Reputation: 34166
It seems like you want a base 10 logarithm:
Math.log10(x);
Upvotes: 3
Reputation: 198321
What base of logarithm is each version using? Java's Math.log
uses base e, or ln
in common math terms.
Upvotes: 1