changeset 29184:dd4cb1ad9dc8

prctile.m, quantile.m: Small formatting changes to cset 7d262c7f8b1d. * NEWS: Wrap announcement about prctile, quantile to 72 characters. Change location in NEWS file to be near related changes. * prctile.m, quantile.m: Use Octave coding conventions of space after '!' not operator. Change conditional input validation test to require just one logical not operation. Change input validation error message to be more specific.
author Rik <rik@octave.org>
date Mon, 14 Dec 2020 14:31:27 -0800
parents dabc5d43db96
children eea3a92651d3
files NEWS scripts/statistics/prctile.m scripts/statistics/quantile.m
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Dec 14 16:14:12 2020 -0500
+++ b/NEWS	Mon Dec 14 14:31:27 2020 -0800
@@ -130,6 +130,9 @@
 
 - The function `dec2bin` and `dec2hex` now support negative numbers.
 
+- The functions `quantile` and `prctile` now permit operating on
+dimensions greater than `ndims (x)`.
+
 - The function `importdata` now produces more compatible results when
 the file contains a 2-D text matrix.
 
@@ -176,9 +179,6 @@
 Matlab code, but for which Octave does not yet implement the
 functionality.  By default, this warning is enabled.
 
-- The functions `quantile` and `prctile` now permit operating on dimensions
-greater than `ndims(x)`.
-
 ### Alphabetical list of new functions added in Octave 7
 
 * `cospi`
--- a/scripts/statistics/prctile.m	Mon Dec 14 16:14:12 2020 -0500
+++ b/scripts/statistics/prctile.m	Mon Dec 14 14:31:27 2020 -0800
@@ -68,8 +68,8 @@
     ## Find the first non-singleton dimension.
     (dim = find (sz > 1, 1)) || (dim = 1);
   else
-    if (!(isscalar (dim) && dim == fix (dim)) || !(1 <= dim))
-      error ("prctile: DIM must be an integer and a valid dimension");
+    if (! (isscalar (dim) && dim == fix (dim) && dim > 0))
+      error ("quantile: DIM must be a positive integer");
     endif
   endif
 
--- a/scripts/statistics/quantile.m	Mon Dec 14 16:14:12 2020 -0500
+++ b/scripts/statistics/quantile.m	Mon Dec 14 14:31:27 2020 -0800
@@ -176,8 +176,8 @@
     ## Find the first non-singleton dimension.
     (dim = find (size (x) > 1, 1)) || (dim = 1);
   else
-    if (!(isscalar (dim) && dim == fix (dim)) || !(1 <= dim))
-      error ("quantile: DIM must be an integer and a valid dimension");
+    if (! (isscalar (dim) && dim == fix (dim) && dim > 0))
+      error ("quantile: DIM must be a positive integer");
     endif
   endif