how to remove difference error of .1e^-16

3 ビュー (過去 30 日間)
bhan stokes
bhan stokes 2017 年 8 月 22 日
編集済み: Jan 2017 年 8 月 22 日
I am working on a program where I am concatenating a number(say 0.3654) after converting it to binary with other bits and then retrieving the same number later on ... when I compare these two numbers it gives an error difference of .111e^-15 which is although very less but it is affecting the results. All the numbers I m dealing with are decimal numbers (0.54354, 0.44362 applying ceil,floor, round is not working.)...can anyone please help to remove the error.
  3 件のコメント
Stephen23
Stephen23 2017 年 8 月 22 日
編集済み: Stephen23 2017 年 8 月 22 日
"I am concatenating a number(say 0.3654).."
Most likely you aren't. You are probably concatenating the closest binary equivalent to the decimal value 0.3654. This is not a bug in MATLAB, this is simply a side-effect of how floating point numbers are stored in binary:
etc., etc.
"can anyone please help to remove the error."
You need to design your algorithm to take floating-point error into account.
Jan
Jan 2017 年 8 月 22 日
編集済み: Jan 2017 年 8 月 22 日
@Stephen: This is the correct answer in my opinion. I hesitate to repeat your explanations by posting it as an answer, but I would vote for it, if you move it to the section for answers.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by