bugGNU Octave - Bugs: bug #55919, Format short|long g does not align...

 
 

bug #55919: Format short|long g does not align numbers within matrices

Submitted by:  None
Submitted on:  Thu 14 Mar 2019 02:44:44 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  5.1.0
Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sat 16 Mar 2019 03:11:16 PM UTC, comment #5:

It looks like "g" mode in pr-output.cc always calls float_format with default arguments, which sets field width to 0 (as wide as necessary) but for non-g modes, float_format is called with 4 arguments that specify a minimum field width. It looks like setting a minimum field width in g-mode should take care of both problems -- it will allow sufficient space between elements and not try to pack too many in one line. Thoughts?

Anonymous
Sat 16 Mar 2019 02:42:49 PM UTC, comment #4:

To see the combined effect of both OP and Rik, try:

Anonymous
Sat 16 Mar 2019 02:27:47 PM UTC, comment #3:

I have this same problem, and it's worse when printing matrices with many columns. Try this:

In normal mode, on my display, it correctly gives Columns 1 through 47, 48 through 94 ... 236 to 256 and the matrix has 4 rows.

In "g" mode, it erroneously gives Columns 1 through 94, 95 through 188, 189 through 256, but the display can accommodate only 47 numbers per row with spaces, so each line of the matrix spills over to 2 lines of unequal length, and the display is a mess.

The calculation of the width of each element in "g" mode forgets to add the space between elements, and tries to pack too many elements per line.

Anonymous
Thu 14 Mar 2019 03:58:16 PM UTC, comment #2:

Just for reference, Matlab behaves the same as Octave 4.2.1 and right aligns the value "1.5" in the second column.

Rik <rik5>
Project Administrator
Thu 14 Mar 2019 03:50:55 PM UTC, comment #1:

Confirmed. This is a regression from version 4.2.1 where this worked. I've changed the Operating System to Any since this also affects Linux and presumably Mac as well.

A more repeatable example that does not rely on random numbers is

The only format that is affected is the 'g' format (short or long) because this format does not print unecessary digits.

The same example run on version 4.2.1 produced

The decimal point is not aligned, but at least the columns are.

Rik <rik5>
Project Administrator
Thu 14 Mar 2019 02:44:44 PM UTC, original submission:

It's OK for format to not align decimals in "short g" or "long g" mode, but not aligning spaces makes it difficult to read matrices.

Anonymous

 

(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 rik5 (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-14 rik5 CategoryNone => Interpreter
        Item GroupNone => Regression
        StatusNone => Confirmed
        Operating SystemMicrosoft Windows => Any
        SummaryFormat does not align space within matrices => Format short|long g does not align numbers within matrices

    Back to the top


    Powered by Savane 3.4