[Pkg-octave-devel] Bug#743672: octave: save -ascii ignores save_precision
Mike Miller
mtmiller at debian.org
Mon Apr 7 17:08:32 UTC 2014
On Sat, Apr 5, 2014 at 01:20:14 +0200, Francesco Potortì wrote:
> octave> format long
> octave> a=1234567890123
> a = 1234567890123
> octave> save a a
> octave> save -ascii a a
> octave> quit
> $ cat a
> 1.23456789e+12
True, but this is not a bug, this is the required behavior for Matlab
compatibility. Note that save -ascii is the Matlab compatible way of
saving data in a plain text format, while save -text (which is also
the default) uses Octave's own plain text format. Use fprintf if you
want more control over how data is represented as text.
So for compatibility, Octave has to save in a fixed floating-point
precision format with -ascii. You can use save -ascii -double to get
twice the precision. This option works and is Matlab compatible but
doesn't appear to be documented at all in Octave. These formats and
options could certainly be documented better.
I would take up the issue of improving the documentation upstream, but
otherwise there's not much to do about this.
--
mike
More information about the Pkg-octave-devel
mailing list