Improper negative number representation
古いコメントを表示
I have encountered a very strange issue. I was having trouble with an if statement that was comparing two numbers. Although the numbers were apparently identical, the equality was seen as false. I dug a little deeper and I found this extremely simple minimal working example. Why is this happening? This doesn't make any sense!
>> format long
>> A = -6*1e-9
A =
-6.000000000000001e-09
2 件のコメント
Vittorio Picco
2020 年 11 月 11 日
David Hill
2020 年 11 月 11 日
Floating point numbers! There is lots of matlab documentation on floating point numbers, you just need to search for it.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Physics についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!