Problem with mod and the value 2.3 times 100
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Katsmeat
il 14 Giu 2015
Risposto: Walter Roberson
il 14 Giu 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 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Object Programming in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!