views:

25

answers:

1

I'm writing a framework for writing HDF files with JAVA (Using some existing framework). I need to keep compatibility with octave. That is, octave should be able to read the files my framework writes and vice versa.

My question is, does Octave have two data types - float and double or it uses only double?

thanks

+1  A: 

Internally Octave handles both double scalar and float scalar, as well as float/double matrices. octave uses templates to instantiate the scalar type so octave can handle both types efficiently.

But your problem seems to be which data format to use when interchanging data with Octave using files.

Octaves default data format to save in is binary, e.g double precision floating point values. But Octave can save in float format, thus truncating the data.

Octave can also save in HDF5 format. All supported formats are listed here.

Java binary object serialization is on the other hand a little bit tricky. That is because Java supports reflection and can serialize and re instantiate objects automatically, but from my experience the file written is not compatible between JVM versions.

Ernelli