Error in bin2dec ?

2 次查看(过去 30 天)
Andres Soler
Andres Soler 2020-6-10
回答: Stephan 2020-6-10
Hi,
I am trying to convert this decimal number to binary: 297237575406453000
I am using bin2dec(297237575406453000) and I get 10000100000000000000000000000000000000000000000000100000000
However, the answer seems to be wrong, if I do it in the windows calculator the result is ‭010000100000000000000000000000000000000000000000000100001000‬ and I verified in python and the conversion is the same as windows calculator
Is it an error in the function? or am I doing something wrong?

回答(1 个)

Stephan
Stephan 2020-6-10
You are not doing wrong - just read the documentation:
"...If the input argument D has a value greater than the value returned by flintmax, then dec2bin might not return an exact representation."
>> flintmax < 297237575406453000
ans =
logical
1

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by