bugGNU Octave - Bugs: bug #43367, rats overly eager to use asterisks

 
 

bug #43367: rats overly eager to use asterisks

Submitted by:  Colin Macdonald <cbm>
Submitted on:  Mon 06 Oct 2014 11:01:59 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.8.2Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 27 Nov 2014 08:19:14 PM UTC, comment #2:

Fixed in cset c490eac28bbb. There is still a matlab incompatibility: 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 LEN and then call rat with this tolerance.

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

I'm closing this report because the original problem (numerator/denumerator overflow) is fixed.

Andreas Weber <andy1978>
Project Member
Tue 07 Oct 2014 02:58:54 PM UTC, comment #1:

Yes it is. The problem seems to be in the stopping criteria for the rational approximation. The routine to investigate is

which is located in libinterp/corefcn/pr-output.cc at line 346.

Rik <rik5>
Project Administrator
Mon 06 Oct 2014 11:01:59 PM UTC, original submission:

Octave:

Matlab:

I find Matlab rats more pleasant ;-)

I think the interpretation of the LEN parameter (5 in my examples) should be: try to find a rational approximation that fits in this many characters and return "*" otherwise.

For example, both Octave and Matlab will use "*" for "rats(pi, 3)".

None of this seems to be documented, but I will file a separate issue for that.

Colin Macdonald <cbm>

 

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

Attach File(s):
   
   
Comment:
   

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 andy1978 (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by cbm (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 27 Nov 2014 08:19:14 PM UTCandy1978StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
      Releasedev=>3.8.2
    Tue 07 Oct 2014 02:58:54 PM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1