[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How many digits does octave use?!
From: |
John Eaton |
Subject: |
Re: How many digits does octave use?! |
Date: |
Tue, 12 Sep 1995 15:00:54 -0500 |
Ted Harding <address@hidden> wrote:
: Well, looking into this I typed the wrong thing, and ...
:
: octave:28> sprintf("%.300g\n",1000000000/(8*8*8*8*8*8*8*8*8*8*8**88))
: ans = 3.1418198177905449939812940511912164115041379279996477216713...
If anything, this is a bug in the iostream library distributed with
libg++. Octave uses the following method of printing numbers (except
that the format string is determined at run-time):
#include <math.h>
#include <iostream.h>
int
main (void)
{
cout.form ("%.70g\n", M_PI);
return 0;
}
When compiled with g++ and linked with libg++, this program prints
3.141592653589793115997963468544185161590576171875
on my DEC Alpha.
I don't think it's worth working around this problem in Octave. It
should be fixed in libg++ instead.
jwe