bugGNU Octave - Bugs: bug #41672, fread for "float" not...


bug #41672: fread for "float" not matlab compatible

Submitted by:  Rik <rik5>
Submitted on:  Sat Feb 22 21:58:20 2014  
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Wed Mar 19 18:46:48 2014, comment #4:

> Does Matlab really always force long to be 32 bits, even on 64-bit Linux systems?

Yes, it does.

On 64-bit Windows R2011a and 64-bit Linux R2010a:

Philipp Kutin <pkutin>
Mon Mar 10 04:38:36 2014, comment #3:

This seems to be the case, the docs for fread/fwrite don't seem to distinguish between platform types.

Someone could verify by running the following in Matlab on 64-bit Windows:

In 64-bit Octave, arr is a one-element array of -1, but in 64-bit Matlab it may be a two-element array of -1.

Mike Miller <mtmiller>
Project Administrator
Sun Feb 23 19:09:43 2014, comment #2:

I suspect that Matlab dropped the system-dependence of the float at some point. We can too.

As for integer types, I think it is pretty much universal now that short is 16 bits and int is 32 bits and on 32-bit systems, long is also 32 bits. But on 64-bit systems, long is 64 bits on Linux systems and still 32 bits on Windows systems. Does Matlab really always force long to be 32 bits, even on 64-bit Linux systems? If so, I guess we have to do the same or I'm sure we'll eventually get complaints about that difference.

John W. Eaton <jwe>
Project Administrator
Sun Feb 23 18:33:17 2014, comment #1:

I think we've eliminated support for all non-IEEE floating point types now, so float will always be 32 bits. But that could be made more explicit to be Matlab compatible. I think the integer types are more troublesome, if we want Matlab compatibility we should get rid of all platform-dependence for the type names, right?

Mike Miller <mtmiller>
Project Administrator
Sat Feb 22 21:58:20 2014, original submission:

This may just be a documentation issue. According to Matlab's documentation for fread (http://www.mathworks.com/help/matlab/ref/fread.html), the 'float' type should always be 32 bits. Octave's documentation states that the 'float' type is platform dependent. In fact this difference occurs for all the types which are not strictly defined by a standard (so short, long, etc.).

I don't if Octave is actually doing what it is saying it does, or whether it too just assumes float is 32 bits always.

Rik <rik5>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by pkutin (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by rik5 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Mar 27 02:45:16 2014mtmillerCategoryNone=>Octave Function
      StatusNeed Info=>Confirmed
    Mon Mar 10 04:38:36 2014mtmillerStatusNone=>Need Info

    Back to the top

    Powered by Savane 3.1-cleanup1