[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Pkg-octave-devel] Bug#743672: octave: save -ascii ignores save_precision



>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.

Yes, that's what I did in the end.  Only, I did not know that this is
required for Matlab compatibility.  Why so?  I ended up using printf,
and Matlab reads my data without problems.

>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. 

Did not know that.  Thanks.  That would have been simpler than using
printf.

>		      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.

Yes

>I would take up the issue of improving the documentation upstream, but
>otherwise there's not much to do about this.

Thanks.  I can help, if you want.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it



Reply to: