octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57615] assert() fails on input which was vali


From: Rik
Subject: [Octave-bug-tracker] [bug #57615] assert() fails on input which was valid in version 5.1
Date: Thu, 16 Jan 2020 19:01:52 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

URL:
  <https://savannah.gnu.org/bugs/?57615>

                 Summary: assert() fails on input which was valid in version
5.1
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Thu 16 Jan 2020 04:01:51 PM PST
                Category: Octave Function
                Severity: 4 - Important
                Priority: 5 - Normal
              Item Group: Regression
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

Sample code:


assert (complex (pi*1e-17,2*pi), 0, 1e-1)
error: sprintf: invalid field width, must be integer >= 0 and <= INT_MAX
error: called from
    assert>pprint at line 705 column 9
    assert at line 419 column 16


However, in 5.1 the result is correct


assert (complex (pi*1e-17,2*pi), 0, 1e-1)
error: ASSERT errors for:  assert (complex (pi * 1e-17, 2 * pi),0,1e-1)

  Location  |  Observed  |  Expected  |  Reason
     ()      3.1416e-17+6.2832i      0         Abs err 6.2832 exceeds tol 0.1
by 6


The problem code is in assert.m


  str = ["ASSERT errors for:  assert " argin "\n"];
  str = [str, "\n  Location  |  Observed  |  Expected  |  Reason\n"];
  for i = 1:length (err.index)
    leni = length (err.index{i});
    leno = length (err.observed{i});
    lene = length (err.expected{i});
    str = [str, sprintf("%*s%*s %*s%*s %*s%*s   %s\n",
                        6+fix(leni/2), err.index{i}   , 6-fix(leni/2), "",
                        6+fix(leno/2), err.observed{i}, 6-fix(leno/2), "",
                        6+fix(lene/2), err.expected{i}, 6-fix(lene/2), "",
                        err.reason{i})];


Trouble is that 6 - XXX may go below zero, as it does here, if the length of
the field is large.





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57615>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]