Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: regarding increasing precision value
Date: Tue, 27 Jan 2009 10:04:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <glmm6i$2on$1@fred.mathworks.com>
References: <18642ed7-fb80-4875-a7db-a79a15a12c4a@r37g2000prr.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233050642 2839 172.30.248.37 (27 Jan 2009 10:04:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 27 Jan 2009 10:04:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:514179


aralimaradsir@gmail.com wrote in message <18642ed7-fb80-4875-a7db-a79a15a12c4a@r37g2000prr.googlegroups.com>...
> Hello friends, i have written a program below which can generate 64
> bit double precision hex value but i require a value of more than 128
> bits can anyone of you help me in this matter thank you
> clc;
> clear all;
> format long
> 
> N=1000;
> x=[.197];
> Y=0;
> y1=0;
> for n=1:1:N
>    Y=4.*x.*(1-x);
>    y1=y1+Y;
>    x=y1;
>    y1=0;
> 
>   end
> disp (Y)
> key=num2hex(Y)

  There are only 53 bits of precision in matlab's double format significand, the other 11 bits being used for exponent and sign.  If you really need 128 bits you might consider the Symbolic Toolbox with decimal number precision set to some very high level in an endeavor to achieve 128 bits accuracy.  However you must realize that decimal precision is not precisely equivalent to binary accuracy.  You might make a single bit error in the 128th bit even though decimal accuracy is set far above 128*log(10)/log(2) = 38 decimal place accuracy.  You should also realize that even if you had a machine using binary floating point numbers with 128 bit precision, your algorithm would still be making rounding errors down at that 128-th place in its multiplications.  Why do you feel the need of just 128 bit precision in particular, as opposed to some other value, higher or lower?
  
  Your code is puzzling.  The quantity y1 is always equal to zero when you do y1=y1+Y, so you are just copying Y into y1 and then on into the next x.  Why are you doing things in this round-about way, as opposed to just

 x = 4*x*(1-x);

at each step?

  The iteration is interesting.  If you plot the x values as a function of the number of steps, it makes an almost random distribution of values which seem to fill up the screen area in a rectangle in a nearly uniform manner except of course in the vicinity of x = 0.75 where one would expect an anomaly, since an exact x = 0.75 would stay constant.  Where did you encounter this peculiar iteration?  It looks like a good example of the fractals in chaos theory.

Roger Stafford