octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #45687] fread does not support ARCH 'ieee-le'


From: Emmanuel Goua de Baix
Subject: [Octave-bug-tracker] [bug #45687] fread does not support ARCH 'ieee-le' for double on 64bits PC
Date: Tue, 04 Aug 2015 08:44:35 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0

URL:
  <http://savannah.gnu.org/bugs/?45687>

                 Summary: fread does not support ARCH 'ieee-le' for double on
64bits PC
                 Project: GNU Octave
            Submitted by: egouadeb
            Submitted on: mar. 04 août 2015 08:44:34 GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

I found an issue to read a double ieee-le in a binary file :

fid=fopen('test_octave_double_01.hex' , 'rb');
x=fread(fid, 1, 'double', 0, 'ieee-le')

returns this error message :

error: fread: impossible state reached in file
'/scratch/jwe/src/mxe-octave/tmp-stable-octave/octave-4.0.0/liboctave/util/data-conv.cc'
at line 702


Additonal information :
Error observed on a Windows7 64bits PC with Octave 4.0.0 (installed from
octave-4.0.0_0-installer.exe).
On a Windows XP 32bits PC, BOTH Matlab AND Octave 4.0.0 give the expected
result :

x =   2.1787e+005

Moreover, on the 64bits PC, the fread command without ARCH option does return
a result but not the expected one since bytes need to be swapped (validated by
swapping manually the bytes):

x=fread(fid, 1, 'double')
> x =   2.7444e-307

Using the option 'native' results in the same error message than 'ieee-le'
(expected since PC is little-endian).
Using the option 'ieee-be' provides the same unwanted value than without
option - and no error message !
Reading to type 'uint32' or 'uint64' does not trigger an error for any ARCH.
Not tested with other types (except uint above).
Not tested on Linux nor Mac.
Not tested with other bytes values.
Not tested on other Octave release.

Due to the 64bits dependancy of this issue, this bug might be related to
#41672 : fread for "float" not matlab compatible

Workaround :
I will add a swap command in my parsing script and use fread without ARCH ...

PS:
'test_octave_double_01.hex' simply contains the following bytes (can be
created/edited by HexEdit) :
00 48 AB 19 8A 98 0A 41

PPS about Item group :
I don't know if it is a Regression, and I don't think it is an
Incorrect/Inaccurate Result, and it is more a Failure than a Crash (error
message) => Other




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: mar. 04 août 2015 08:44:34 GMT  Name: test_octave_double_01.hex  Size:
8 o   By: egouadeb

<http://savannah.gnu.org/bugs/download.php?file_id=34573>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45687>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/




reply via email to

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