Mercurial > octave
changeset 33596:96a203bc7e17 bytecode-interpreter
maint: Merge default to bytecode-interpreter
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Fri, 17 May 2024 22:49:58 -0400 |
parents | 8a833798c741 (current diff) e8e951bcf701 (diff) |
children | e7b0ea3ae6c8 |
files | etc/NEWS.9.md |
diffstat | 3 files changed, 36 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/NEWS.9.md Fri May 17 09:32:40 2024 -0400 +++ b/etc/NEWS.9.md Fri May 17 22:49:58 2024 -0400 @@ -6,7 +6,7 @@ ### Improvements and fixes - `hist.m`: Add input validation for `Y` restricting it to 2-D array - (bug #65478). + (bug #65478). Avoid error when `Y` value range is very small (bug #65714). - `cross.m`: Add input validation for `dim` restricting it to a numeric integer valued scalar (bug #65544, bug #65527). - `getframe.m`: Respect pixel ratio (high DPI) of screen with figure
--- a/libinterp/corefcn/graphics.cc Fri May 17 09:32:40 2024 -0400 +++ b/libinterp/corefcn/graphics.cc Fri May 17 22:49:58 2024 -0400 @@ -4932,9 +4932,11 @@ plist.erase ("units"); plist.erase ("position"); + plist.erase ("innerposition"); plist.erase ("outerposition"); plist.erase ("paperunits"); plist.erase ("paperposition"); + plist.erase ("paperpositionmode"); plist.erase ("windowstyle"); remove_all_listeners (); @@ -12335,15 +12337,23 @@ %! close (hf); %! end_unwind_protect -%!test # root object +%!test # figure object %! set (0, "defaultfigurevisible", "off"); -%! hf = figure ("visible", "off", "paperunits", "centimeters", -%! "papertype", "a4"); +%! hf = figure ("visible", "off", +%! "units", "normalized", +%! "position", [0, 0, pi/10, e/10], +%! "paperunits", "normalized", +%! "paperposition", [0.1, 0.1, 0.9, 0.9], +%! "tag", "foobar"); %! unwind_protect %! reset (hf); -%! assert (get (hf, "papertype"), get (0, "defaultfigurepapertype")); -%! assert (get (hf, "paperunits"), "centimeters"); # paperunits is unchanged -%! assert (get (hf, "visible"), get (0, "defaultfigurevisible")); +%! ## Ordinary property is reset +%! assert (get (hf, "tag"), ""); +%! ## Following 4 special properties are not reset +%! assert (get (hf, "units"), "normalized"); +%! assert (get (hf, "position"), [0, 0, pi/10, e/10]); +%! assert (get (hf, "paperunits"), "normalized"); +%! assert (get (hf, "paperposition"), [0.1, 0.1, 0.9, 0.9]); %! unwind_protect_cleanup %! close (hf); %! set (0, "defaultfigurevisible", "remove");
--- a/scripts/plot/draw/hist.m Fri May 17 09:32:40 2024 -0400 +++ b/scripts/plot/draw/hist.m Fri May 17 22:49:58 2024 -0400 @@ -127,8 +127,9 @@ if (nargin == 1 || ischar (varargin{iarg})) n = 10; ## Use integer range values and perform division last to preserve - ## accuracy. - if (min_val != max_val) + ## accuracy. If max - min is less than 20*eps, treat as if min = max to + ## avoid bug #65714 error. + if (min_val != max_val && diff ([min_val, max_val]) > 20 * eps) x = 1:2:2*n; x = ((max_val - min_val) * x + 2*n*min_val) / (2*n); else @@ -153,8 +154,9 @@ error ("hist: number of bins NBINS must be positive"); endif ## Use integer range values and perform division last to preserve - ## accuracy. - if (min_val != max_val) + ## accuracy. If max - min is less than 20*eps, treat as if min = max + ## to avoid bug #65714 error. + if (min_val != max_val && diff ([min_val, max_val]) > 20 * eps) x = 1:2:2*n; x = ((max_val - min_val) * x + 2*n*min_val) / (2*n); else @@ -429,6 +431,19 @@ %! [nb, xb] = hist (b, 30); %! assert ({na, xa}, {nb, xb}); +%!test <*65714> # Avoid error if diff(y) is very small. +%! a = [1, 1+eps, 1+ 15*eps]; +%! hf = figure ("visible", "off"); +%! unwind_protect +%! hax = axes ("parent", hf); +%! hist (hax, a); +%! hp = get (hax, "children"); +%! assert (max (get (hp, "ydata")(:)), 3); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + + ## Test input validation %!error <Invalid call> hist () %!error <Y must be real-valued> hist (2+i)