help-octave
[Top][All Lists]
Advanced

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

Re: cell2csv (io package): Higher precision of floating point numbers?


From: PhilipNienhuis
Subject: Re: cell2csv (io package): Higher precision of floating point numbers?
Date: Wed, 24 Aug 2016 05:13:16 -0700 (PDT)

Martin Kunz wrote
> Hi Philip,
> 
> Thanks for your reply! Working on Windows this felt a bit adventurous. ;-)

Nah, no fear, most of my development work concerned with OF packages happens
on Windows.
mkoctfile is wonderfully portable :-)


> I downloaded io 2.4.2 manually from Octave-Forge and and unpacked it. As
> my problem was with writing data to .csv, I looked into cell2csv.cc,

So I mixed up cell2csv and csv2cell there :-) oopsie
Anyway you managed to do the right thing....


> which luckily is a rather simple file. In line 117 there is:
> 
>     sprintf(tmp, "%g", c(i, j).double_value());
> 
> 
> which I changed to
> 
>     sprintf(tmp, "%.12g", c(i, j).double_value());
> 
> 
> Excited as I was I did not look at your instructions again, but just
> repacked the modified package and installed it with

That isn't strictly needed.
You can put csv2cell.cc anywhere and build it; to run it the compiled .oct
file just needs to be somewhere in Octave's search path.

Once it works properly you can put it in
/lib/octave/packages/io-<version>/<arch>/, no need to reinstall the complete
io package.


> For the "%g" output conversion the specified precision is the maximum
> number of significant digits to print, hence numbers exactly
> representable with fewer digits are not padded with zeros and the
> resulting files are not blown up too much. You might therefore consider
> to adopt this change to the official io package?

Not that many people need so much precision. Any idea what number of digits
are output by e.g., csvwrite ?

A new io release is due anyway because of some recently uncovered obscure
bugs. I'll gladly consider your suggestion, thanks.

Thank you for reporting back,

Philip



--
View this message in context: 
http://octave.1599824.n4.nabble.com/cell2csv-io-package-Higher-precision-of-floating-point-numbers-tp4679437p4679450.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]