view test/bug-54490.tst @ 32103:32313c5e1bfc

Don't use 2-digit exponent format for ticklabels when unnecessary. * graphics.cc (calc_ticklabels): New boolean variable is_2digit_exp. Cycle through ticklabel values using log10 to determine if maximum exponent is greater than or equal to 10. As soon as this condition is found set is_2digit_exp to true and break out of loop. Within ticklabel formatting loop, only print leading '0' if is_2digit_exp is true and the current exponent to be printed is less than 10.
author Rik <rik@octave.org>
date Wed, 31 May 2023 10:44:35 -0700
parents 9080316864bf
children
line wrap: on
line source

%!function out = bug54490 ()
%!  global k;
%!  k = 1;
%!  out = 3;
%!endfunction

%!test <*54490>
%! global k;
%! k = 2;
%! a = [5, 6];
%! a(k) = bug54490 ();
%! assert (a, [5, 3]);
%! k = 2;
%! a = [5, 6];
%! [a(k)] = bug54490 ();
%! assert (a, [5, 3]);
%! clear -global k;  # cleanup after test