bugGNU Octave - Bugs: bug #39832, document that "format"...

 
 

bug #39832: document that "format" option can directly change "output_precision"

Submitter:  None
Submitted:  Wed 21 Aug 2013 02:50:14 AM UTC
   
 
Category:  Documentation Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  paul Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  8.1.0
Planned Release:  8.1.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 10 Dec 2022 02:18:31 PM UTC, comment #2: 

pushed a small doc change to note the interaction in both functions as
https://hg.savannah.gnu.org/hgweb/octave/rev/ccbf38427774

closing as fixed

Nicholas Jankowski <nrjank>
Group Member
Fri 09 Dec 2022 10:33:50 PM UTC, comment #1: 

looking at this older report and trying to understand what if any the current documentation needs might be. there have been some changes to format in the past decade. Currently format recognizes 3 'catogories': spacing (compact/loose), case (upper/lower), numberdisplay (short, long, longE, +, etc).

 Regarding the first concern (format compact doesn't reset format, but others do):

Octave 8.0.1

>> format default
>> pi(2,2)
ans =

   3.1416   3.1416
   3.1416   3.1416

>> format longe
>> pi(2,2)
ans =

   3.141592653589793e+00   3.141592653589793e+00
   3.141592653589793e+00   3.141592653589793e+00

>> format compact
>> pi(2,2)
ans =
   3.141592653589793e+00   3.141592653589793e+00
   3.141592653589793e+00   3.141592653589793e+00

>> format loose
>> pi(2,2)
ans =

   3.141592653589793e+00   3.141592653589793e+00
   3.141592653589793e+00   3.141592653589793e+00

>> format uppercase
>> pi(2,2)
ans =

   3.141592653589793E+00   3.141592653589793E+00
   3.141592653589793E+00   3.141592653589793E+00

>> format lowercase
>> pi(2,2)
ans =

   3.141592653589793e+00   3.141592653589793e+00
   3.141592653589793e+00   3.141592653589793e+00

>> format compact
>> pi(2,2)
ans =
   3.141592653589793e+00   3.141592653589793e+00
   3.141592653589793e+00   3.141592653589793e+00

>> format +
>> pi(2,2)
ans =
++
++

>> format loose
>> pi(2,2)
ans =

++
++

>> format uppercase
>> pi(2,2)
ans =

++
++

>>


so compact/loose doesn't impact upper/lowercase or numberdisplay., and upper/lowercase doesn't impact compact/loose or numberdisplay.

Next:

>> format default
>> pi(2,2)
ans =

   3.1416   3.1416
   3.1416   3.1416

>> format shorte
>> pi(2,2)
ans =

   3.1416e+00   3.1416e+00
   3.1416e+00   3.1416e+00

>> format compact
>> pi(2,2)
ans =
   3.1416e+00   3.1416e+00
   3.1416e+00   3.1416e+00

>> format long
>> pi(2,2)
ans =
   3.141592653589793   3.141592653589793
   3.141592653589793   3.141592653589793

numberdisplay doesn't impact compact/loose.


last:

>> format default
>> pi(2,2)
ans =

   3.1416   3.1416
   3.1416   3.1416

>> format shorte
>> pi(2,2)
ans =

   3.1416e+00   3.1416e+00
   3.1416e+00   3.1416e+00

>> format hex
>> pi(2,2)
ans =

  400921fb54442d18  400921fb54442d18
  400921fb54442d18  400921fb54442d18

>> format shortE
>> pi(2,2)
ans =

   3.1416e+00   3.1416e+00
   3.1416e+00   3.1416e+00

>> format uppercase
>> pi(2,2)
ans =

   3.1416E+00   3.1416E+00
   3.1416E+00   3.1416E+00

>> format hex
>> pi(2,2)
ans =

  400921FB54442D18  400921FB54442D18
  400921FB54442D18  400921FB54442D18


numberdisplay doesn't seem to impact upper/lowercase.

SO, it seems to me that currently, the different format options are fairly independent and don't 'reset' each other.

regarding issue 2:

>> format default
>> output_precision
ans = 5
>> format long
>> output_precision
ans = 16


yes, the numberdisplay formats are  meant to directly change output_precision.  the others though:


>> format default
>> format shorte
>> pi(2,2)
ans =

   3.1416e+00   3.1416e+00
   3.1416e+00   3.1416e+00

>> output_precision (7)
>> pi(2,2)
ans =

   3.141593e+00   3.141593e+00
   3.141593e+00   3.141593e+00

>> format uppercase
>> pi(2,2)
ans =

   3.141593E+00   3.141593E+00
   3.141593E+00   3.141593E+00

>> format compact
>> pi(2,2)
ans =
   3.141593E+00   3.141593E+00
   3.141593E+00   3.141593E+00


appropriately leave output_precision alone.

IN SUMMARY:  it appears the 1st concern has been satisfied. will look for an appropriate place to mention the tie between format and the output_precision variable.

Nicholas Jankowski <nrjank>
Group Member
Wed 21 Aug 2013 02:50:14 AM UTC, original submission:  

OS is Windows 7, but not directly.  It is via Cygwin.

The documentation for the "format" command can be augmented by telling the user know that "format compact" does not reset the format state, whereas other format statements (e.g. format short e) do.  Therefore, "format compact" should be used after other format statements.

Furthermore, the format statement adjusts the output_precision, so the desired output_precision should be set after invoking the desired format statements.  This interdependence can be described in the help for both commands.

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 nrjank (Posted a comment)
  • -email is unavailable- added by None (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-10 nrjank StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 8.1.0
        Planned ReleaseNone 8.1.0
    2022-12-09 nrjank StatusNeed Info Confirmed
        SummaryDescribe order-dependent behaviour of &quot;format&quot; and &quot;output_precision&quot; statements document that "format" option can directly change "output_precision"
    2019-03-01 mtmiller Carbon-CopyRemoved 80942 -
    2014-03-27 mtmiller Severity3 - Normal 1 - Wish
        StatusNone Need Info
        Release3.6.2 dev
        Operating SystemOther Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code