Problem with mod and the value 2.3 times 100
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Katsmeat
el 14 de Jun. de 2015
Respondida: Walter Roberson
el 14 de Jun. de 2015
There seems to be some kind of overflow problem with mod, which occurs on all the Matlab versions I have access to - 2007a, 2010a and 2014b.
> format long
> mod(2.3*100,10)
> 9.999999999999972
mod(230,10) is fine and gives the right value, zero, but
> qqq=2.3*100
> mod(qqq,10)
Also misbehaves. However
> qqq=2.3*10*10
> mod(qqq,10)
Is fine and does give a result of zero. I'm confused. I was going to submit a bug report, but it seems odd that a bug so easily found could be hanging around for so long. Could somebody offer some insight as to what's going on?
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Graphics Object Programming 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!