problem with a simple division
Mostra commenti meno recenti
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
Risposte (1)
Roger Stafford
il 17 Set 2013
0 voti
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.
Categorie
Scopri di più su Multidimensional Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!