How I can multiply 2 variables without losing precision

3 visualizaciones (últimos 30 días)
Yuriy
Yuriy el 4 de Jul. de 2014
Comentada: John D'Errico el 4 de Jul. de 2014
a= 378979003;
b= 1.443e-5;
The result of a*b is 5468.7 but I'm very interested in higher precision (such as 5468.6670). How to achieve those precision?
  1 comentario
John D'Errico
John D'Errico el 4 de Jul. de 2014
The point of both answers is that MATLAB never did "lose" any precision. You did not see those extra digits because of the wrong format for your goals.

Iniciar sesión para comentar.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 4 de Jul. de 2014
You can check that a*b and 5468.7 are not equal
a*b==5468.7
Now try this
format long
c=a*b

Más respuestas (1)

Ben11
Ben11 el 4 de Jul. de 2014
Try this:
a= 378979003;
b= 1.443e-5;
format long
a*b
ans =
5.468667013290000e+03

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by