Mercurial > octave
changeset 33604:631cc5fdf697
Backed out changeset e8e951bcf701
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Sat, 18 May 2024 22:26:10 -0400 |
parents | dff73f774f03 |
children | 9e9725f13742 338a70ccc1bb |
files | etc/NEWS.9.md scripts/plot/draw/hist.m |
diffstat | 2 files changed, 5 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/NEWS.9.md Sat May 18 17:42:08 2024 -0400 +++ b/etc/NEWS.9.md Sat May 18 22:26:10 2024 -0400 @@ -6,7 +6,7 @@ ### Improvements and fixes - `hist.m`: Add input validation for `Y` restricting it to 2-D array - (bug #65478). Avoid error when `Y` value range is very small (bug #65714). + (bug #65478). - `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/scripts/plot/draw/hist.m Sat May 18 17:42:08 2024 -0400 +++ b/scripts/plot/draw/hist.m Sat May 18 22:26:10 2024 -0400 @@ -127,9 +127,8 @@ if (nargin == 1 || ischar (varargin{iarg})) n = 10; ## Use integer range values and perform division last to preserve - ## 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) + ## accuracy. + if (min_val != max_val) x = 1:2:2*n; x = ((max_val - min_val) * x + 2*n*min_val) / (2*n); else @@ -154,9 +153,8 @@ error ("hist: number of bins NBINS must be positive"); endif ## Use integer range values and perform division last to preserve - ## 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) + ## accuracy. + if (min_val != max_val) x = 1:2:2*n; x = ((max_val - min_val) * x + 2*n*min_val) / (2*n); else @@ -431,19 +429,6 @@ %! [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)