Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: computation precision and display
Date: Tue, 4 Dec 2012 01:01:10 +0000 (UTC)
Organization: Venezuelan Institute for Scientific Research
Lines: 40
Message-ID: <k9ji0m$rcv$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1354582870 28063 172.30.248.47 (4 Dec 2012 01:01:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Dec 2012 01:01:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1188900
Xref: news.mathworks.com comp.soft-sys.matlab:784099

Hi,

It just happens in my linux 64 bits PC, running Matlab 2010a  (on format long g) that when I calculate

>> A=(0.714844838298060 + 0.699283102297360i)*conj(0.714844838298060 + 0.699283102297360i)

A =

         1.000000000000000

Now when I calculate


>> B=(0.757342604591773 + 0.653017748051421i)*conj(0.757342604591773 + 0.653017748051421i)

B =

                         1

And the difference is:

>>A-B

ans =

     -1.11022302462516e-16

This is important because when I try to plot A and B as elements of a matrix with a colormap using imagesc they get very different colors.

Then my questions are:

How to interpret a number such as A=1.000000000000000?

Is it possible to display its nonzero decimals after the 15th zero?

Another important question is that Matlab seems to make this kind of rounding off randomly so many other complex numbers when operated as above produce results sometimes displayed as an exact one or a one follwed by many zeroes.

So, how can this be controlled or predicted?

Thanks.