How to get rid of exponent notation from a variable output?
3 views (last 30 days)
Show older comments
Moyen Mishra
on 22 Mar 2017
Answered: Walter Roberson
on 22 Mar 2017
I have to use the output as a 16 bit binary string to convert to decimal. Example : bin2dec has an error when the variable is '1.000011110100011e+16'. How can I alter this variable before using the function bin2dec.
Thank you.
0 Comments
Accepted Answer
Walter Roberson
on 22 Mar 2017
You do not have a binary string. You have a 17 digit decimal number stored as floating point. That number is also too large to represent as an exact integer in floating point. The number which is 16 ones in a row does fit into double precision as an exact integer, but it would show up as about 1.1e+15, ten times smaller than what you have.
You should rework your code so that you never produce values that are intended to be binary in the form of decimal numbers. If you have constants in that form, switch to using strings and bin2dec
0 Comments
More Answers (0)
See Also
Categories
Find more on Digital Input and Output 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!