'save_precision' doesn't work
Sergei Steshenko
sergstesh at yahoo.com
Wed Dec 24 11:28:43 CST 2008
--- On Wed, 12/24/08, Jaroslav Hajek <highegg at gmail.com> wrote:
> From: Jaroslav Hajek <highegg at gmail.com>
> Subject: Re: 'save_precision' doesn't work
> To: sergstesh at yahoo.com
> Cc: bug-octave at octave.org
> Date: Wednesday, December 24, 2008, 12:28 AM
> On Tue, Dec 23, 2008 at 10:47 PM, Sergei Steshenko
> <sergstesh at yahoo.com> wrote:
> > Hello All,
> >
> > please see the session below - I expected much more
> significant digits in
> > 'foo.txt' file.
> >
> >
> > Thanks,
> > Sergei.
> >
> > The session:
> >
> > octave:1> save_precision(30);
> > octave:2> output_precision(30);
> > octave:3> foo = 1/3
> > foo = 3.33333333333333314829616256247e-01
> > octave:4> save('-ascii', 'foo.txt',
> 'foo');
> > octave:5> system('cat foo.txt');
> > 3.33333333e-01
> > octave:6> version
> > ans = 3.0.3
> > octave:7>
> >
>
> Well, this is, in fact, correct. The help for
> save_precision says that
> it's the default precision for the "text"
> format (save -text), not the
> "ascii" format.
> The ascii format has a precision of 8 digits. The best
> option here is
> probably to support also -double and -tabs for -ascii.
> Currently,
> they're unsupported.
>
> cheers
>
> --
> RNDr. Jaroslav Hajek
> computing expert
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
There is no sense in having a 'save' subroutine which always truncates
data, i.e. if it's not a bug in code (i.e. the code works as advertised),
it's a bug in spec, i.e. the code implements wrong goals.
I think that 'save_precision' should simply affect all 'save' operations.
Currently as a workaround I'm using 'fprintf' which luckily obeys format
specification.
Thanks,
Sergei.
P.S. Will there be an 'octave' fully fledged bug tracking systems (like
'bugzilla', 'trac', the one offered by SourceForge, etc.) ? I think the
project is big and complex enough to really have it.
More information about the Bug-octave
mailing list