diff libinterp/corefcn/max.cc @ 19591:6b09dd576521

Fix cummin/cummax operations on rows when NaN element present (bug #44009). * mx-inlines.cc (OP_CUMMINMAX_FCN2): Add missing else clauses. * max.cc (Fcummin, Fcummax): Add BIST tests for cummin and cummax to verify fix. * contributors.in: Add Lachlan Andrew to list of contributors.
author Lachlan Andrew <lachlanbis@gmail.com>
date Mon, 19 Jan 2015 21:05:39 -0800
parents 78e424d31596
children 4197fc428c7d
line wrap: on
line diff
--- a/libinterp/corefcn/max.cc	Sun Jan 18 10:38:11 2015 -0800
+++ b/libinterp/corefcn/max.cc	Mon Jan 19 21:05:39 2015 -0800
@@ -1016,6 +1016,7 @@
 %!assert (cummin ([1, 4, 2, 3]), [1 1 1 1])
 %!assert (cummin ([1; -10; 5; -2]), [1; -10; -10; -10])
 %!assert (cummin ([4, i; -2, 2]), [4, i; -2, i])
+%!assert (cummin ([1 2; NaN 1], 2), [1 1; NaN 1])
 
 %!test
 %! x = reshape (1:8, [2,2,2]);
@@ -1027,6 +1028,7 @@
 %! assert (ndims (iw), 3);
 %! assert (iw, ones (2,2,2));
 
+
 %!error cummin ()
 %!error cummin (1, 2, 3)
 */
@@ -1070,6 +1072,7 @@
 %!assert (cummax ([1, 4, 2, 3]), [1 4 4 4])
 %!assert (cummax ([1; -10; 5; -2]), [1; 1; 5; 5])
 %!assert (cummax ([4, i 4.9, -2, 2, 3+4i]), [4, 4, 4.9, 4.9, 4.9, 3+4i])
+%!assert (cummax ([1 NaN 0; NaN NaN 1], 2), [1 1 1; NaN NaN 1])
 
 %!test
 %! x = reshape (8:-1:1, [2,2,2]);