From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: help on eigen values
Date: Wed, 11 May 2011 15:34:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 18
Message-ID: <iqea9d$95m$>
References: <iqcevu$mqk$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1305128045 9398 (11 May 2011 15:34:05 GMT)
NNTP-Posting-Date: Wed, 11 May 2011 15:34:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:726230

"meena rao" <> wrote in message <iqcevu$mqk$>...
> ......
> Is the value in the workspace of lamda1 is right. .....
> ......
- - - - - - - - -
  Meena, it is very important for Matlab users to understand the difference between the actual binary floating point value of a quantity stored within memory and a displayed approximate decimal representation of that quantity.  The stored value is what is actually used in computation, while the displayed value is only an approximate indication of its value for the user's benefit.

  As John has indicated, the accuracy of such displays is controlled by the 'format' setting.  The default "format short" gives four digits after the decimal point while "format long" for example gives about 14 places after the decimal point (for 'double' numbers.)  The only one of the 'format' settings that is guaranteed to give the precise value is "format hex", but unfortunately that is difficult to interpret for persons accustomed to decimal numbers.

  Here's an example using the quantity 'pi'.  With the default "format short" it is displayed as "3.1416", with "format long" it is shown as "3.14159265358979", and with "format hex" it appears as a rather mysterious "400921fb54442d18".  Only this last is a precise representation of the true stored value.  If this were given as a binary fraction it would be the mind-boggling 53-bit number:


and this is what actually would be used in computation with 'pi'.  This should show you why more compact representations are desirable for display purposes.

  (Of course, since the true mathematical pi is a transcendental number, even the above binary number is only an approximation accurate to 53 bits - the best that double precision floating point can do.)

Roger Stafford