4 views (last 30 days)
Show older comments
Martin on 6 Mar 2021
Commented: Jan on 6 Mar 2021
I have problems with num2str format
I get a number from an API:
I need the exact number as str output. For instance I know it is:
I tried with:
however this gives me the following wrong result:
Anyone have a clue what can be wrong here?
Edited: Jan on 6 Mar 2021
What does "I get a number from an API: 8.1784e+17" mean? Is this a char vector, string or a UINT64 or double scalar? In the last case, remember that doubles contain about 16 digits only. So there is no chance to store a value with 18 digitis accurately.
x = uint64(817835078876192769)
% uint64 817835078876192769
% uint64 817835078876192768
So the problem might be, that the value is provided as double value. You need to store the value as UINT64 or as char array or string.
More Answers (0)
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!