0

I work with matlab.My answer is this

1.0e-13 *

-0.4710
0.0133

I tried format long g but this time answer is

-4.70969527418052e-14 

I do not want number with e.How can fixed this?

Sun
  • 11
  • 7

2 Answers2

2

You can use sprintf('%0.55f',your_var) if you want. Change how many decimals you want printed by changing the number. Its 55 in this example.

I think this is a terrible idea. You are plotting raw floating point representation, it confuses you more than it helps. If you need accuracy in decimals of the order of e-20, you may be doing something wrong, or just not using the right tool.

I think before you continue you should have a read to the following post:

Why is 24.0000 not equal to 24.0000 in MATLAB?

Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
  • I don't need accuracy, I just want to get the long version of number. – Sun May 28 '20 at 10:26
  • @Sun if you dont care about the decimal values (i.e. you dont need accuracy), then why would you want to print them? I added the disclaimer because of that doubt. – Ander Biguri May 28 '20 at 10:31
1

There is another possibility using the symbolic toolbox:

precision=64
vpa(sym(z,"f"),64)

The output is:

-0.00000000000004709999999999999620518877985217527098343349989395534294089884497
Ash
  • 4,611
  • 6
  • 27
  • 41