problem with a simple division
Ältere Kommentare anzeigen
I have variable named, n. where
n =0.0500 ;
whos n shows:
1x1(size) 8(bytes) double(class)
now when i am doing,
z=n/0.001;
it gives me z=49.9997 !!!!!!!! but it should be 50.
When I do it in command line it gives me exact 50 .
What am i doing wrong?
N.B : n is coming from a subtraction of two values from a 'csv' file i am reading by csvread
Antworten (1)
Roger Stafford
am 17 Sep. 2013
0 Stimmen
To get that far away from 50, your n cannot be equal to 0.0500. It is actually something like 0.0499997 which in "format short" would be displayed as 0.0500 . Try using "format long" and see if this isn't true.
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!