problem with a simple division
古いコメントを表示
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
回答 (1 件)
Roger Stafford
2013 年 9 月 17 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!