octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #62417] 'format' errors on names with spaces w


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #62417] 'format' errors on names with spaces when calling with function form
Date: Wed, 11 May 2022 10:44:25 -0400 (EDT)

Follow-up Comment #21, bug #62417 (project octave):

re: comment 18:   


works:
format short e
format shorte
format('short','e')
format('shorte')

errors:
format "short e"
format("short e")


all of which is fine, except this isn't a matter of combining different option
strings, as in 'copyfile a b'.  we explicitly name the format option as 'short
e', with quotes in many places.  e, E, g, and Eng are not independent options.
they only exist following long or short', and those are listed as different
specific option strings:


     'long'
          Fixed point format with 16 significant figures.

          As with the 'short' format, Octave will switch to an
          exponential 'e' format if it is unable to format a matrix
          properly using the current format.

     'short e'
     'long e'
          Exponential format.  The number to be represented is split
          between a mantissa and an exponent (power of 10).  The
          mantissa has 5 significant digits in the short format.  In the
          long format, double values are displayed with 16 significant
          digits and single values are displayed with 8.  For example,
          with the 'short e' format, 'pi' is displayed as '3.1416e+00'.

     'short g'
     'long g'
          Optimally choose between fixed point and exponential format
          based on the magnitude of the number.  For example, with the
          'short g' format, 'pi .^ [2; 4; 8; 16; 32]' is displayed as

               ans =

                     9.8696
                     97.409
                     9488.5
                 9.0032e+07
                 8.1058e+15

     'short eng'
     'long eng'
          Identical to 'short e' or 'long e' but displays the value
          using an engineering format, where the exponent is divisible
          by 3.  For example, with the 'short eng' format, '10 * pi' is
          displayed as '31.416e+00'.
...


it would be like if in integral we described the option 'Waypoints' as 'Way
points', but didn't tell the user they can't call it as 'Way points'.  I had
to look at the code to realize why the 'short eng' format can't be called as
'short eng'.

in m-code it would be simple to use a switch/case with case {'shorteng, 'short
eng'} to capture both, without any ambiguity in intent, and to match the
documentation as published. I still support either a doc change to clarify the
conflicting messaging, or doing the equivalent in the compiled function.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62417>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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