help-octave
[Top][All Lists]

## Re: Another newbie question

 From: nwerneck Subject: Re: Another newbie question Date: Thu, 31 Jul 2003 15:09:48 -0300 User-agent: Mutt/1.3.28i

```I found this message on the list archive with the same subject, and it
seems that octave-forge has an arbitrary precision package.

http://www.octave.org/octave-lists/archive/help-octave.2002/msg00343.html

I couldn't find it on Debian's octave-forge package although :/

Just for the records, the same happens with Matlab, but I don't know if
it has an arbitrary precision add-on.

Also,  for  those  who  are  arguing:  The  extra  digits are not random
garbage,  they are simply the result of the conversion from the base two
integer mantissa to the base ten representation. I may be wrong, but the
biggest "precision" existent is 52 decimal places:

oct:7> (2-2**-52)
ans =  1.99999999999999977795539507496869191527366638183593750000000e+00

There is no way you can represent a number in double precision that will
span  more decimal places that this. The zeros at the end will always be
zeros.  It's  an  EXACT number what is written above, all the 50 decimal
digits,  but  it does it does not means that hat double presicion has 50
digits of precision.

It   is  not  a  bug  with  octave,  or  with  C,  this  is  the  hidden
binary-integer  nature  of  floating  point  numbers.  If  computers had
10-states bits that would not happen. Instead, it would be obvious where
the precision ends.

The  floating point decimal precision ends at the 15th place, the binary
precision  is a little bigger: (2-2**-52), (2-2**-51) and (2-2**-50) all
yields  15  digits  '9'  after  the  decimal  point.

I hope this was of any help... bye!

On Wed, Jul 30, 2003 at 10:44:20PM -0500, John W. Eaton wrote:
> On 30-Jul-2003, Fausto Arinos Barbuto <address@hidden> wrote:
>
> |     Even though output_precision = 48 unveils lots of digits for,
> | say, pi or sqrt(2.0), I found out that only the first 15 are exact
> | -- the rest seems to be rubbish.
>
> Octave does floating point arithmetic.  It is not an arbitray
> precision calculator.
>
> | And should 32-digit
> | precision is *not* possible, why does Octave show so many useless
> | digits?
>
> Perhaps a warning should be issued if you try to set output_precision
> too high.  It should be relatively easy to do so.  Would someone like
> to provide a patch?
>
> Thanks,
>
> jwe
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
>
>

--
Nicolau Werneck <address@hidden>         9F99 25AB E47E 8724 2F71
http://cefala.org/~nwerneck                   EA40 DC23 42CE 6B76 B07F
"The great tragedy of science -- the slaying of a beautiful hypothesis by an
ugly fact. "
-- Thomas Huxley

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```