I have written the simple function, which determines the logarithm to base b of x.
function [y] = logBase(b,x)
y = log(x)/log(b);
Recently, I've observed a weird behaviour. If I determine ceil(y), I got wrong results for specific values.
For example: We know, that the logarithm of 125 to the base 5 is 3. When I let Matlab calculate it, it outputs 3.000. Now when I take the ceil-operator, I get 4 instead 3.
I think it has something to do with the form of the logBase-output. It outputs 3.0000 and ceil(3.000) outputs 4. But it should be 3.
Can someone help me with my problem? Thank You!