on-internet
← Community

How can I find the log 2 base of a double variable?

Stack Overflow ·

I'm trying to calculate the log 2 base of some double type numbers, but it seems that there isn't a standard method from a library for this. I tried the following approach, however it produces errors. double entropy=0; for(int i=0; i<26;i++){ entropy+=-possibilityCounter[i]*log2(possibilityCounter[i]); } Note: The possibilityCounter table contains double types, e.g 0.00133536. Any suggestions?

Comments

Sign in or sign up to comment and upvote.

No comments yet.