First, the quote from help says: "entropy converts any class other than logical to uint8 for the histogram count calculation"
I did following 2 tests:
1) A = 0:255; % here A is double and
entropy(A) gives 0.0369
2) A = uint8(0:255);
entropy(A) gives 8
It looks like it doesn't convert to uint8.
Second, I tried formula -sum(p.*log2(p))
[p,x] = imhist(A);
-sum(p.*log2(p)) gives 0, which is obvious because histogram of the given A makes 256 bins with 1 in every bin, and log2(1) = 0.
What was wrong in my tests?