help-octave
[Top][All Lists]
Advanced

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

Re: How can I increase or decrise the lenth os scaling !


From: Mike Miller
Subject: Re: How can I increase or decrise the lenth os scaling !
Date: Fri, 29 Nov 2002 13:43:38 -0600 (CST)

On Fri, 29 Nov 2002, A S Hodel wrote:

> At the octave prompt, type in
>
>       help format
>       help printf


(I didn't send the original question, but...)

Octave has some good output options.  I wonder how hard it would be to
come up with something even more general.  I definitely could use
something that would allow me to force output to, say, 4 digits behind the
decimal.

I know that JWE and others are very busy, but I wonder what you all think
of the following idea:

format n.m

where n,m are integers.  m expresses the *exact* number of digits to be
displayed to the right of the decimal point and n expresses the *maximum*
number of digits to the left.  If any value in the output is larger than
10^(n-1), the display would revert to E notation with n+m-1 digits to the
right of the decimal and one digit to the left.  Format 0.m would have
special meaning:  with 0.m, Octave would not revert to E notation for any
number of digits to the left of the decimal.  In this proposed system, the
following would be equivalent:

format 0.2  ==  format bank

The problem with "format short" and "format long" is that they are
erratic, in a sense.  For example, if you do this...

rand(2)

...with default format, Octave will display 5, 6 or 7 digits to the right
of the decimal depending on the exact values of the random numbers.  And
with short format...

format short ; rand(2)

...Octave will display either 3 or 4 digits to the right of the decimal.

When I know that my numbers will be between 0 and 1, I might prefer
"format 1.7" to Octave's default format, or "format 1.4" to "format short".

Is there any hope that something like "format n.m" will be implemented in
Octave some day?

Mike



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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