log2() only works with double types?

2 views (last 30 days)
log2() seems to only work with 'double' types. It throws error when argument is int64.
num = 10000;
d = floor(num / 7);
a = log2(d);
disp(a);
10.4798
d = int64(num / 7);
b = log2(double(d));
disp(b);
10.4808
b = log2(d);
Check for incorrect argument data type or missing argument in call to function 'log2'.
disp(b);

Accepted Answer

Simon Chan
Simon Chan on 24 Oct 2021
Check MATLAB documentation and this fucntion log2 supports type single or double as the input argument type.
  3 Comments
atharva aalok
atharva aalok on 24 Oct 2021
That was great help Steven! Thanks a ton!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!