Borrar filtros
Borrar filtros

how to increse no digits after decimal point?

2 visualizaciones (últimos 30 días)
rajesh kumar
rajesh kumar el 1 de Sept. de 2018
Editada: Stephen23 el 4 de Sept. de 2018
in matlab coding i am getting ans =0.0012 i want to getting ans =0.001234903423 what to do please suggest me
  1 comentario
jonas
jonas el 1 de Sept. de 2018
Editada: jonas el 1 de Sept. de 2018
You can always use format long, but I don't know if you can specify the number of decimals more than that.

Iniciar sesión para comentar.

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 1 de Sept. de 2018
Editada: KALYAN ACHARJYA el 1 de Sept. de 2018
fprintf('%.12f', ans) %Upto 12 floating points, you can change the value range
  3 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 1 de Sept. de 2018
Editada: KALYAN ACHARJYA el 1 de Sept. de 2018
fprintf('%.10f', ans)
Stephen23
Stephen23 el 4 de Sept. de 2018
Editada: Stephen23 el 4 de Sept. de 2018
"Upto 12 floating points"
Why 12? Where does this limit come from? I don't see this limit mentioned anywhere in the fprintf help, nor is it related to the precisions of either double or single floating point numbers:
When I try 15 decimal digits, it works just fine:
>> X = 0.123456789012345;
>> fprintf('%.15f\n',X)
0.123456789012345
Where did you get this "Upto 12 floating points" limit from?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by