Rounding using 'fix'... possibly a bug?
Mostra commenti meno recenti
Could someone tell me if this is a bug, or is there some logical reason 'fix' would round:
.3/.1 = 2
whereas
.4/.1 = 4
K>> fix(.3/.1)
ans =
2
K>> fix(.4/.1)
ans =
4
K>> fix(.7/.1)
ans =
6
K>> fix(.5/.1)
ans =
5
1 Commento
Jan
il 14 Ott 2013
It is such surprising that the well known floating point effects appear for beginners usually for the value 0.3 . Usually it is:
find((0:0.1:1) == 0.3) % replies [] !!!
Risposta accettata
Più risposte (1)
Image Analyst
il 14 Ott 2013
1 voto
Categorie
Scopri di più su Physics in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!