From: Alaa on 26 Dec 2009 09:22 Hello, i've been trying to increase the precision of a varaiable of type double, but i couldn't do it. example: if i enter: x= 5.1234567666 the answer will be: ans: x=5.1234 what can i do to get the real value. Thanks, for your answers.
From: dpb on 26 Dec 2009 09:47 Alaa wrote: > Hello, i've been trying to increase the precision of a varaiable of type > double, but i couldn't do it. > example: > if i enter: x= 5.1234567666 > the answer will be: ans: x=5.1234 > what can i do to get the real value. > Thanks, for your answers. doc format % at the console if in file i/o or other string usage see the formatting strings in fprintf() and friends or the optional precision argument in num2str() --
From: Rob Comer on 26 Dec 2009 09:48 > i've been trying to increase the precision of a variable of type double, but i couldn't do it. > example: > if i enter: x= 5.1234567666 > the answer will be: ans: x=5.1234 > what can i do to get the real value. Use the format command. Try >> format long g for example.
From: Alaa on 26 Dec 2009 09:56 Thanks Mr. "Rob Comer" , "dbp", it was the format as you have said. Any way i've find it all alone before etting your answers, but thank you very much. The format function affects only how numbers are displayed, not how MATLAB computes or saves them, and thats what i want.
From: ImageAnalyst on 26 Dec 2009 10:43
On Dec 26, 9:56 am, "Alaa " <alaio_hi...(a)hotmail.com> wrote: > Thanks Mr. "Rob Comer" , "dbp", it was the format as you have said. > Any way i've find it all alone before etting your answers, but thank you very much. > The format function affects only how numbers are displayed, not how MATLAB computes or saves them, and thats what i want. --------------------------------------------- Alaa: So you know that format is just how the numbers are displayed and not the actual number. That means that you know that x is a double and even though it says 5.1235 in the command window and the workspace that it will really show the complete number you typed in if you look at it in the variable editor (double click the variable in the workspace panel). Ok, so far so good. But now you say that how "MATLAB computes or saves them" is not enough even though you know it's double precision. So that must mean that basically you're asking if there is a quadruple precision. Is that a correct assessment of where you stand? As far as I know there is no quadruple precision but someone else may have a way of doing it. Can you tell us why double precision is not enough and why you need quad precision? |