# HG changeset patch # User John W. Eaton # Date 1582829153 18000 # Node ID c31c9eaa1f28598e2fdf59623e6866cbaaaf1cdd # Parent 4f1d1b1d4afc11999cd9ea3fa3e1153e02a22179 sparse-xpow.cc: use xisint instead of static_cast to check int values diff -r 4f1d1b1d4afc -r c31c9eaa1f28 libinterp/corefcn/sparse-xpow.cc --- a/libinterp/corefcn/sparse-xpow.cc Fri Feb 28 07:59:34 2020 +0100 +++ b/libinterp/corefcn/sparse-xpow.cc Thu Feb 27 13:45:53 2020 -0500 @@ -67,7 +67,7 @@ if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be a square matrix. Use .^ for elementwise power."); - if (static_cast (b) != b) + if (! xisint (b)) error ("use full(a) ^ full(b)"); int btmp = static_cast (b); @@ -135,7 +135,7 @@ if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be a square matrix. Use .^ for elementwise power."); - if (static_cast (b) != b) + if (! xisint (b)) error ("use full(a) ^ full(b)"); int btmp = static_cast (b); @@ -329,7 +329,7 @@ octave_idx_type nr = a.rows (); octave_idx_type nc = a.cols (); - if (static_cast (b) != b && a.any_element_is_negative ()) + if (! xisint (b) && a.any_element_is_negative ()) { ComplexMatrix result (nr, nc, Complex (std::pow (0.0, b))); @@ -363,7 +363,7 @@ retval = octave_value (result); } } - else if (static_cast (b) != b && a.any_element_is_negative ()) + else if (! xisint (b) && a.any_element_is_negative ()) { SparseComplexMatrix result (a); @@ -427,7 +427,7 @@ if (a.data(i) < 0.0) { double btmp = b (a.ridx (i), j); - if (static_cast (btmp) != btmp) + if (! xisint (btmp)) { convert_to_complex = 1; goto done;