10 raised to the power

29 views (last 30 days)
Snoopy
Snoopy on 12 Aug 2021
Edited: Snoopy on 12 Aug 2021
When I multiply two matrices element wise (which is probably not important to my question), some numbers appear as 3.400000000000001e+03 instead of simply 3400. Why?

Accepted Answer

Star Strider
Star Strider on 12 Aug 2021
Put simply: format if you are viewing them in the Command Window. This is likely also due to floating-point approximation error, as described in Floating-Point Numbers.
Otherwise, change the format descriptor in fprintf formatSpec or similar function calls to change the way they are displayed in those function calls.
There is not enough detail in the Question to provide an exact response.
.
  2 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Numeric Types in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!