bugGNU Octave - Bugs: bug #63961, interpreter incorrectly displays...

 
 

bug #63961: interpreter incorrectly displays integer imaginary value when real part is Inf

Submitter:  Rik <rik5>
Submitted:  Sun 26 Mar 2023 12:52:58 AM UTC
   
 
Category:  Interpreter Severity:  4 - Important
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  rik5 Open/Closed:  * Closed
Release:  * stable Operating System:  * Any
Fixed Release:  None Planned Release:  8.2.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 11 Apr 2023 06:58:30 PM UTC, comment #4: 

No comments.  Marking as Fixed and closing report.

Rik <rik5>
Group administrator
Fri 07 Apr 2023 07:22:15 PM UTC, comment #3: 

I checked in a minimal change to get this working here http://hg.savannah.gnu.org/hgweb/octave/rev/1f7958de177f.

After several hours of inspection there are definitely improvements that might be made, but this will work for the 8.2 bug fix release and more work can occur on the development branch.

Marking as Ready For Test.

Rik <rik5>
Group administrator
Tue 04 Apr 2023 04:14:40 PM UTC, comment #2: 

Maybe something like this patch?



(file #54558)

John W. Eaton <jwe>
Group administrator
Tue 04 Apr 2023 09:41:37 AM UTC, comment #1: 

The problem is avoided if the matrix code for computing formats is also used for scalars:


octave:1> z = complex (Inf, 1.5)
z =     Inf + 1.5000i
octave:2> z2 = [z, z]
z2 =

      Inf + 1.5000i      Inf + 1.5000i

octave:3> z2(1)
ans =     Inf + 1.5000i
octave:4> z3 = complex (1.5, Inf)
z3 =  1.5000 +    Infi
octave:5> z4 = complex (realmax, 1.5)
z4 =  1.7977e+308 +  1.5000e+00i


I'm not saying that the attached change is the fix we want, just demonstrating that you are right that we need the same logic for both cases.

Ugh, looking at the pr-output.cc file now, I think a lot of the logic in there is about 30 years old now and demonstrates about how well I understood this problem way back then.



(file #54555)

John W. Eaton <jwe>
Group administrator
Sun 26 Mar 2023 12:52:58 AM UTC, original submission:  

This bug has been present for quite a while, and is quite serious as Octave incorrectly communicates the wrong value of an internal variable.

Sample Code


octave:1> z = complex (Inf, 1.5)
z =  Inf +   2i
octave:2> z2 = [z, z]
z2 =

      Inf + 1.5000i      Inf + 1.5000i

octave:3> z2(1)
ans =  Inf +   2i
octave:4> z3 = complex (1.5, Inf)
z3 =    2 + Infi
z4 = complex (realmax, 1.5)
z4 =  1.7977e+308 +  1.5000e+00i


From the code above, Octave displays arrays correctly.  It is only a problem with scalars and it doesn't matter whether the Inf is located in the imaginary or the real part of the complex number.

My guess is that the scalar display routine is not checking with isinf() before calculating number of digits.

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #54558:  pr-output-diff-2.txt added by jwe (3KiB - text/plain)
file #54555:  pr-output-diff.txt added by jwe (1KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by rik5 (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-11 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2023-04-07 rik5 StatusConfirmed Ready For Test
    2023-04-04 jwe Attached File- Added pr-output-diff-2.txt, #54558
    2023-04-04 jwe Attached File- Added pr-output-diff.txt, #54555

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code