patchGNU Octave - Patches: patch #9689, Bug fix in library function rat.m

 
 

patch #9689: Bug fix in library function rat.m

Submitter:  Erich <dynamic>
Submitted:  Thu 06 Sep 2018 08:04:04 PM UTC
   
 
Category:  Core : new feature Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 07 Dec 2018 06:15:38 AM UTC, comment #1: 

I rewrote a lot of rat.m in this changeset https://hg.savannah.gnu.org/hgweb/octave/rev/b5418132423f.  This fixes the display of extreme values (-Inf, 0, Inf) and behavior is now equivalent to Matlab.  Closing this issue.

Rik <rik5>
Group administrator
Thu 06 Sep 2018 08:04:04 PM UTC, original submission:  

Hello,
the library function rat.m providing rational approximation has a somewhat unfavorable behavior when calling it with the values
rat(0)
rat(inf)
rat(-inf)

In either case, I get a divsion by zero warning and the results are poor.

I added a zero check in line 73,
old version:   idx = find (abs (y-n./d) >= tol);
patch version: idx = find (y!=0 & abs (y-n./d) >= tol);

With this correction, no error occurs, and the results are acceptable.
I suggest to provide the patch version with the next release.

Best regards,
Dynamic


Erich <dynamic>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #44947:  rat.m added by dynamic (4KiB - application/octet-stream - rat.m patch version 20180906)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-07 rik5 StatusNone Done
        Open/ClosedOpen Closed
    2018-09-06 dynamic Attached File- Added rat.m, #44947

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code