bugGNU Octave - Bugs: bug #47964, rats test failure on Debian i386

 
 

bug #47964: rats test failure on Debian i386

Submitter:  Mike Miller <mtmiller>
Submitted:  Thu 19 May 2016 05:58:41 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 19 May 2016 10:49:36 PM UTC, comment #2: 

Fixed on the default branch with this change:

http://hg.savannah.gnu.org/hgweb/octave/rev/61f3575250e4

Mike Miller <mtmiller>
Group Member
Thu 19 May 2016 10:17:03 PM UTC, comment #1: 

The following condition at line 392 of the rational_approx function is failing the first time through the loop, so the returned string is "0":


if (fabs (frac) < 1 / static_cast<double> (std::numeric_limits<int>::max ()))


where the value frac is exactly equal to 1.0/2147483647.

http://hg.savannah.gnu.org/hgweb/octave/file/@/libinterp/corefcn/pr-output.cc#l391

My i386 build is also done with -O0, if that makes a difference here.

Mike Miller <mtmiller>
Group Member
Thu 19 May 2016 05:58:41 PM UTC, original submission:  

I see a new test failure (meaning the same test doesn't fail on the stable branch) in pr-output.cc:


>> test pr-output.cc-tst
***** test
 v = 1 / double (intmax);
 err = v - str2num (rats(v, 12));
 assert (err, 0, 4 * eps);
!!!!! test failed
ASSERT errors for:  assert (err,0,4 * eps)

  Location  |  Observed  |  Expected  |  Reason
     ()       4.6566e-10       0         Abs err 4.6566e-10 exceeds tol 8.8818e-16


The underlying cause seems to be this difference between 4.0.2 and the default branch (both on Debian unstable i386):


>> rats (1 / double (intmax), 12)
ans = 1/2147483647
>> rats (1 / double (intmax - 1), 12)
ans = 1/2147483646


vs


>> rats (1 / double (intmax), 12)
ans =            0
>> rats (1 / double (intmax - 1), 12)
ans = 1/2147483646


Any thoughts on where this difference came in on the default branch? I remember some discussion about intmax being off by one, that's all I can think of at the moment.

Mike Miller <mtmiller>
Group Member

 

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

Attach Files:
   
   
Comment:
   

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 (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 group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-19 mtmiller StatusNeed Info Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code