bugGNU Octave - Bugs: bug #43717, rats LEN Matlab incompatibility


bug #43717: rats LEN Matlab incompatibility

Submitted by:  Andreas Weber <andy1978>
Submitted on:  Thu 27 Nov 2014 08:27:40 PM UTC  
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  WTF, Matlab?!?
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

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


Tue 01 May 2018 08:35:11 PM UTC, comment #1:

Still present. It seems to me that Matlab is trying to ensure that at least one space is included at the start and end of the string, so that the strings can always be safely concatenated end-to-end.

Mike Miller <mtmiller>
Project Administrator
Thu 27 Nov 2014 08:27:40 PM UTC, original submission:

Octave tries to find an approximation which fits into LEN (second arg of rats) but Matlab seems to do some fancy stuff to calculate a tolerance from the input vector X and LEN and then call rat with this tolerance. The strings returned from Matlab are often less shorter than LEN even if a better approximation would be possible.

For example octave returns 22/7 for rats(pi, 4) whereas Matlab returns " *", see http://octave.1599824.n4.nabble.com/Matlab-output-from-quot-rats-quot-wanted-tt4667406.html and the Matlab documentation under More About - Algorithms.

Personally I think Octave's behaviour is much better here but I want to document this here.

If someone want to investigate this further: Try a changeset after c490eac28bbb which fixed an overflow in rats (#43369).

Andreas Weber <andy1978>
Project Member


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by andy1978 (Submitted the item)

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

    Only project members can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-01 mtmiller Severity3 - Normal => 2 - Minor
        Release3.8.2 => dev
    2015-01-01 andy1978 Item GroupMatlab Compatibility => WTF, Matlab?!?
    2014-12-31 rik5 Priority5 - Normal => 3 - Low

    Back to the top

    Powered by Savane 3.4