How to round the decimal values?

1 visualización (últimos 30 días)
Ahmed Roshbik
Ahmed Roshbik el 10 de Mzo. de 2020
Comentada: Ahmed Roshbik el 10 de Mzo. de 2020
Hello
i have a project and i cant round up the value 0.7954 to the value 0.796, can someone help me?
Thank you.
  2 comentarios
Walter Roberson
Walter Roberson el 10 de Mzo. de 2020
Why would it round up? To 3 decimal places it is closer to 0.795
Ahmed Roshbik
Ahmed Roshbik el 10 de Mzo. de 2020
i know it does that already but the rest of calculations depends on the value being 0.796

Iniciar sesión para comentar.

Respuestas (1)

Adam
Adam el 10 de Mzo. de 2020
Editada: Adam el 10 de Mzo. de 2020
ceil( 0.7954 * 1000 ) / 1000
It should also be noted though that many seemingly 'round' decimal numbers cannot be perfectly represented in floating point so that you likely will not have precisely 0.796 as your final answer.
  1 comentario
Ahmed Roshbik
Ahmed Roshbik el 10 de Mzo. de 2020
it didn't round up to 0.796 it still reads 0.795

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by