float to binary ?
显示 更早的评论
Hi,
Why does this function round and how do you return the same number without rounding
A=0.569546;
B = float2bin(A)
C=bin2float(B)
result: c= 0.5695
回答(2 个)
Are you sure that there is a rounding? Or is it the display in the command window only?
A = 0.569546;
B = float2bin(A)
C = bin2float(B)
A - C
format long g % Adjust the format of the display
C
float2bin and bin2float are no commands of Matlab's toolboxes. So maybe it would help to mention, where you ot these functions from.
the cyclist
2021-3-8
Assuming that you are using this File Exchange entry, it doesn't round. The issue is that the default MATLAB display format only shows the first 4 figures. Try this instead:
format long
A=0.569546;
B = float2bin(A)
C=bin2float(B)
类别
在 帮助中心 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!