[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New format() options "uppercase"|"lowercase"
From: |
Kai Torben Ohlhus |
Subject: |
Re: New format() options "uppercase"|"lowercase" |
Date: |
Wed, 16 Oct 2019 00:14:10 +0900 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 |
On 10/15/19 1:38 AM, Rik wrote:
> All,
>
> I have changed format so that it is Matlab-compatible by default. This
> meant treating the arguments to format in a case insensitive manner. As
> such, the Octave extensions 'short E', 'long E', 'short G', 'long G' no
> longer change the case of the 'e|E' in exponential notation.
>
> Instead, there are now two new options to format for which I will quote
> from the documentation:
>
> The following two options affect the display of scientific and hex
> notations.
>
> 'lowercase (default)'
> Use a lowercase 'e' for the exponent character in scientific
> notation and lowercase 'a-f' for the hex digits representing
> 10-15.
>
> 'uppercase'
> Use an uppercase 'E' for the exponent character in scientific
> notation and uppercase 'A-F' for the hex digits representing
> 10-15.
>
> See https://hg.savannah.gnu.org/hgweb/octave/rev/bea2823affa4.
>
> --Rik
>
Dear Rik,
Thank you for this improvement, I just tried it out and like it =)
My following examples might be caused by misunderstanding the new
options. In a fresh Octave session, without custom settings regarding
the format, I get:
octave:1> [FORMAT, FORMATSPACING, UPPERCASE] = format
FORMAT = short
FORMATSPACING = loose
UPPERCASE = lowercase
octave:2> format long e uppercase
octave:3> [FORMAT, FORMATSPACING, UPPERCASE] = format
FORMAT = longe
FORMATSPACING = loose
UPPERCASE = lowercase % "uppercase" ignored without error/warning?
octave:4> format long uppercase
error: format: unrecognized option 'long uppercase'
% Does the order matter?
octave:5> format uppercase
octave:6> [FORMAT, FORMATSPACING, UPPERCASE] = format
FORMAT = longe
FORMATSPACING = loose
UPPERCASE = uppercase
% Above is what I expected to obtain by both calls:
% format long e uppercase
% format uppercase long e
octave:7> format
octave:8> [FORMAT, FORMATSPACING, UPPERCASE] = format
FORMAT = short
FORMATSPACING = loose
UPPERCASE = uppercase
% Calling "format" without arguments and return values should reset the
default, but isn't that "UPPERCASE = lowercase"?
When looking at the test cases, I think those options must be called one
by one, right? In this case I wished to receive errors for my stupid
input, rather than silent ignorance. And the resetting of the default
state is surprising to me.
Anyways this new type is a much more intuitive syntax than "longE" and
"longe".
Kai