bugGNU Octave - Bugs: bug #30163, Feature Request: Engineering...

 
 

bug #30163: Feature Request: Engineering format for display

Submitter:  Rik <rik5>
Submitted:  Thu 17 Jun 2010 04:24:10 AM UTC
   
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  dbateman
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
   

Wed 07 Jul 2010 10:47:49 PM UTC, comment #5: 


The fact is I don't have access to matlab, so I have no idea how matlab really implements. The only example in the matlab manual is for the display of Pi, which isn't really one of those corner cases that would help figure out how they implemented this feature. So I just used the layout that most pleased me

The disadvantage with the way I implemented "format long eng" is that up to two of the least significant digits are pure fiction, as they are below the machine precision, but I prefer that to a ragged layout, or to not displaying up to 2 digits that are significant ;-)

D.

David Bateman <dbateman>
Group Member
Wed 07 Jul 2010 09:57:00 PM UTC, comment #4: 

Awesome.  I've been wanting an engineering format for over a year now.  I like your formatting even more than Matlab which has a ragged right edge for 'format long eng'.

Rik <rik5>
Group administrator
Tue 06 Jul 2010 07:08:57 PM UTC, comment #3: 

Ok I tested a bit more, found a couple of bugs, documented it and pushed it to savannah in the changeset

http://hg.savannah.gnu.org/hgweb/octave/rev/38bdcbb58df7

It seems pretty stable to me for all the cases I threw at it. I'm closing this feature request.

Cheers
David

David Bateman <dbateman>
Group Member
Tue 06 Jul 2010 01:24:48 AM UTC, comment #2: 

Previous version of the patch had some strange effects around 1e-99 and 1e+101. Revised patch attached

D.


(file #20906)

David Bateman <dbateman>
Group Member
Tue 06 Jul 2010 12:37:58 AM UTC, comment #1: 

Does the patch attached do what you want? I haven't tested it much but it appears fine here. So I'd be happy if you test it and give some feedback

D.

(file #20905)

David Bateman <dbateman>
Group Member
Thu 17 Jun 2010 04:24:10 AM UTC, original submission:  

The target user for most of Octave is scientists and engineers.  The
scientists can already display results in their favorite format,
scientific notation.  Engineers, however, have to make due with
scientific notation.  As an electrical engineer I do a lot of work with
kiloOhms and megaOhms and it would be much more convenient if I could
display results in an engineering format (mantissa + exponent where the
exponent is a multiple of 3).

I realize the C++ stream libraries don't naturally support engineering
format, but a look at the code in pr-output.cc seems like it should be
possible to insert a routine that does the work before passing it on to
the output.  Not that it matters, but Matlab has figured it out and
'format eng' is an accepted command
(http://www.mathworks.com/access/helpdesk/help/techdoc/ref/format.html).

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 #20906:  patch2 added by dbateman (14KiB - application/octet-stream)
file #20905:  patch added by dbateman (12KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dbateman (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-06 dbateman Open/ClosedOpen Closed
    2010-07-06 dbateman StatusReady For Test Fixed
    2010-07-06 dbateman Attached File- Added patch2, #20906
    2010-07-06 dbateman Attached File- Added patch, #20905
        StatusNone Ready For Test
        Assigned toNone dbateman

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code