octave-maintainers
[Top][All Lists]
Advanced

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

Patch to fix floating point format strings to match fopen documentation


From: Mike Miller
Subject: Patch to fix floating point format strings to match fopen documentation
Date: Wed, 21 Mar 2012 18:35:32 -0400

Attached patch changes the string representations of the floating
point format types recognized by octave.  The intent is for the
following to work:

octave:1> fd = fopen('datafile.dat', 'w');
octave:2> [name, mode, mach] = fopen(fd)
name = datafile.dat
mode = wb
mach = ieee-le

so that the machine representation return values match the strings
listed in the fopen help text.  Also, return values are compatible
with Matlab.

Bonus, the following will now work, too, although it's redundant and
less efficient.

octave:3> fd = fopen('datafile.dat', 'w', native_float_format());

This could break any existing code that depends on specific string
values from native_float_format or octave_config_info, I think that is
as far as it goes though.  The contents of those return values are
currently undocumented.

Before:
octave:1> native_float_format ()
ans = ieee_little_endian
octave:2> octave_config_info ('float_format')
ans = ieee_little_endian

After:
octave:1> native_float_format ()
ans = ieee-le
octave:2> octave_config_info ('float_format')
ans = ieee-le

-- 
mike

Attachment: octave-aa490c112c88.patch
Description: Text Data


reply via email to

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