Borrar filtros
Borrar filtros

Modulo of realmax in matlab

1 visualización (últimos 30 días)
Mayank Bajpai
Mayank Bajpai el 31 de Oct. de 2020
Comentada: Ameer Hamza el 31 de Oct. de 2020
I am getting the same results for the following:
mod(realmax,10^9 + 7) and mod(realmax-10000,10^9 + 7) or subtracting any other number from realmax.
What is the reason for this and how to resolve it?

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 31 de Oct. de 2020
MATLAB double datatype is based on IEEE-754 format: https://en.wikipedia.org/wiki/Double-precision_floating-point_format. This is a finite precision datatype, and you cannot represent all possible integer values accurately in this format.
flintmax
gives the maximum consecutive integer values, which can be accurately represented in this format. Above that, only a few integer values are precisely represented. In your case, realmax-10000 will just round off to realmax since double() data type does not have the precision to represent it.
  2 comentarios
Mayank Bajpai
Mayank Bajpai el 31 de Oct. de 2020
Thanks. Got it :O
Ameer Hamza
Ameer Hamza el 31 de Oct. de 2020
I am glad to be of help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by