Cannot get mod to return correct value

I am trying to solve:
3^233 mod(353).
In Matlab, mod(3^233,353) = 92
But the correct answer is 248.
Is the number to large? Is this a configuration issue? Is there not enough digits being kept for the calculation? Do I need to do this another way?
Thank you.

 Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 16 de Jul. de 2020

0 votos

3^233 is an integer. Its value is roughly 1.5e111. So it needs 112 digits to record the integer value accurately. Double-precision data can't do that. I don't think MATLAB is the right tool for this.

1 comentario

Eugene Browder
Eugene Browder el 16 de Jul. de 2020
Thank you for responding. I was trying to find the max values that could be used. Especially for the mod function.

Iniciar sesión para comentar.

Más respuestas (1)

jonas
jonas el 16 de Jul. de 2020

0 votos

1 comentario

Eugene Browder
Eugene Browder el 16 de Jul. de 2020
Thank you for responding. That looks promising. I will give that a try.

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 16 de Jul. de 2020

Comentada:

el 16 de Jul. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by