Mercurial > octave
changeset 26596:cc0d942d0e20
Remove inconsistent warning "Octave:divide-by-zero" (bug #46650).
* libinterp/corefcn/errwarn.h (warn_divide_by_zero),
libinterp/corefcn/errwarn.cc (warn_divide_by_zero): Deprecate function
"warn_divide_by_zero", and leave implementation empty for a few releases.
* libinterp/corefcn/error.cc: Use different id for test.
* examples/code/make_int.cc: No longer advertise "warn_divide_by_zero" in the
examples.
* libinterp/operators/op-*-*.cc: Remove unused header "errwarn.h". Remove check
for scalar zero divisor including the warning.
* libinterp/operators/op-dms-template.cc (gripe_if_zero): Remove function.
* scripts/general/quadgk.m, scripts/general/quadv.m,
scripts/statistics/kurtosis.m, scripts/statistics/mean.m,
scripts/statistics/skewness.m: No longer need to turn off unused warning.
* scripts/help/warning_ids.m: Remove documentation of "Octave:divide-by-zero".
* test/jit.tst, test/mk-sparse-tst.sh, test/prefer.tst: Remove warning
"Octave:divide-by-zero".
line wrap: on
line diff
--- a/examples/code/make_int.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/examples/code/make_int.cc Tue Jan 22 14:34:08 2019 +0100 @@ -12,7 +12,6 @@ #include <octave/str-vec.h> #include <octave/defun-dld.h> -#include <octave/errwarn.h> #include <octave/interpreter.h> #include <octave/ops.h> #include <octave/ov-base.h> @@ -161,12 +160,7 @@ const octave_integer& v1 = dynamic_cast<const octave_integer&> (a1); const octave_integer& v2 = dynamic_cast<const octave_integer&> (a2); - int d = v2.integer_value (); - - if (d == 0) - warn_divide_by_zero (); - - return new octave_integer (v1.integer_value () / d); + return new octave_integer (v1.integer_value () / v2.integer_value ()); } @@ -175,12 +169,7 @@ const octave_integer& v1 = dynamic_cast<const octave_integer&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return new octave_scalar (v1.double_value () / d); + return new octave_scalar (v1.double_value () / v2.double_value ()); } DEFBINOP (ldiv, integer, integer) @@ -188,12 +177,7 @@ const octave_integer& v1 = dynamic_cast<const octave_integer&> (a1); const octave_integer& v2 = dynamic_cast<const octave_integer&> (a2); - int d = v1.integer_value (); - - if (d == 0) - warn_divide_by_zero (); - - return new octave_integer (v2.integer_value () / d); + return new octave_integer (v2.integer_value () / v1.integer_value ()); } DEFBINOP_OP (lt, integer, integer, <) @@ -210,12 +194,7 @@ const octave_integer& v1 = dynamic_cast<const octave_integer&> (a1); const octave_integer& v2 = dynamic_cast<const octave_integer&> (a2); - int d = v2.integer_value (); - - if (d == 0) - warn_divide_by_zero (); - - return new octave_integer (v1.integer_value () / d); + return new octave_integer (v1.integer_value () / v2.integer_value ()); } DEFBINOP (el_ldiv, integer, integer) @@ -223,12 +202,7 @@ const octave_integer& v1 = dynamic_cast<const octave_integer&> (a1); const octave_integer& v2 = dynamic_cast<const octave_integer&> (a2); - int d = v1.integer_value (); - - if (d == 0) - warn_divide_by_zero (); - - return new octave_integer (v2.integer_value () / d); + return new octave_integer (v2.integer_value () / v1.integer_value ()); } DEFBINOP_OP (el_and, integer, integer, &&)
--- a/libinterp/corefcn/error.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/corefcn/error.cc Tue Jan 22 14:34:08 2019 +0100 @@ -993,7 +993,7 @@ else if (arg.is_string ()) { tmpstr = arg.string_value (); // 2-stage assignment required - msg = tmpstr.c_str (); // in order to generate pointer + msg = tmpstr.c_str (); // in order to generate pointer // to valid memory. } } @@ -1819,7 +1819,7 @@ /* %!test <*51997> -%! id = "Octave:divide-by-zero"; +%! id = "Octave:logical-conversion"; %! current = warning ("query", id); %! current_all = warning (); %! previous = warning (current_all);
--- a/libinterp/corefcn/errwarn.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/corefcn/errwarn.cc Tue Jan 22 14:34:08 2019 +0100 @@ -324,12 +324,6 @@ } void -warn_divide_by_zero (void) -{ - warning_with_id ("Octave:divide-by-zero", "division by zero"); -} - -void warn_empty_arg (const char *name) { warning ("%s: argument is empty matrix", name);
--- a/libinterp/corefcn/errwarn.h Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/corefcn/errwarn.h Tue Jan 22 14:34:08 2019 +0100 @@ -164,9 +164,6 @@ const std::string& pkg = "Octave"); OCTINTERP_API extern void -warn_divide_by_zero (void); - -OCTINTERP_API extern void warn_empty_arg (const char *name); OCTINTERP_API extern void @@ -185,4 +182,11 @@ OCTINTERP_API extern void warn_wrong_type_arg (const char *name, const octave_value& tc); +#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) + +OCTAVE_DEPRECATED (6, "do not use 'Octave:divide-by-zero'") +OCTINTERP_API extern void warn_divide_by_zero (void) {} + #endif + +#endif
--- a/libinterp/operators/op-cm-cs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cm-cs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-cx-mat.h" @@ -47,12 +46,7 @@ = dynamic_cast<const octave_complex_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_array_value () / d); + return octave_value (v1.complex_array_value () / v2.complex_value ()); } DEFBINOP_FN (pow, complex_matrix, complex, xpow) @@ -93,12 +87,7 @@ = dynamic_cast<const octave_complex_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_array_value () / d); + return octave_value (v1.complex_array_value () / v2.complex_value ()); } DEFNDBINOP_FN (el_pow, complex_matrix, complex, complex_array, complex,
--- a/libinterp/operators/op-cm-s.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cm-s.cc Tue Jan 22 14:34:08 2019 +0100 @@ -27,7 +27,6 @@ #include "mx-cm-s.h" #include "mx-cnda-s.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-cx-mat.h" @@ -50,12 +49,7 @@ = dynamic_cast<const octave_complex_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_array_value () / d); + return octave_value (v1.complex_array_value () / v2.double_value ()); } DEFBINOP_FN (pow, complex_matrix, scalar, xpow) @@ -91,12 +85,7 @@ = dynamic_cast<const octave_complex_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_array_value () / d); + return octave_value (v1.complex_array_value () / v2.double_value ()); } DEFNDBINOP_FN (el_pow, complex_matrix, scalar, complex_array, scalar, elem_xpow)
--- a/libinterp/operators/op-cm-scm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cm-scm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -54,14 +53,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_array_value () / d); - } + return octave_value (v1.complex_array_value () / v2.complex_value ()); else { MatrixType typ = v2.matrix_type ();
--- a/libinterp/operators/op-cm-sm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cm-sm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -54,14 +53,7 @@ = dynamic_cast<const octave_sparse_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_array_value () / d); - } + return octave_value (v1.complex_array_value () / v2.scalar_value ()); else { MatrixType typ = v2.matrix_type ();
--- a/libinterp/operators/op-cs-cm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cs-cm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -64,12 +63,7 @@ const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_array_value () / d); + return octave_value (v2.complex_array_value () / v1.complex_value ()); } DEFNDCMPLXCMPOP_FN (lt, complex, complex_matrix, complex, complex_array, @@ -97,12 +91,7 @@ const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_array_value () / d); + return octave_value (v2.complex_array_value () / v1.complex_value ()); } DEFNDBINOP_FN (el_and, complex, complex_matrix, complex, complex_array,
--- a/libinterp/operators/op-cs-cs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cs-cs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -26,7 +26,6 @@ #include "Array-util.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -75,12 +74,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_value () / d); + return octave_value (v1.complex_value () / v2.complex_value ()); } DEFBINOP_FN (pow, complex, complex, xpow) @@ -90,12 +84,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_value () / d); + return octave_value (v2.complex_value () / v1.complex_value ()); } DEFCMPLXCMPOP_OP (lt, complex, complex, <) @@ -112,12 +101,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_value () / d); + return octave_value (v1.complex_value () / v2.complex_value ()); } DEFBINOP_FN (el_pow, complex, complex, xpow) @@ -127,12 +111,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_value () / d); + return octave_value (v2.complex_value () / v1.complex_value ()); } DEFBINOP (el_and, complex, complex)
--- a/libinterp/operators/op-cs-m.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cs-m.cc Tue Jan 22 14:34:08 2019 +0100 @@ -29,7 +29,6 @@ #include "mx-cs-nda.h" #include "mx-nda-cs.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -68,12 +67,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.array_value () / d); + return octave_value (v2.array_value () / v1.complex_value ()); } DEFNDCMPLXCMPOP_FN (lt, complex, matrix, complex, array, mx_el_lt) @@ -92,12 +86,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.array_value () / d); + return octave_value (v2.array_value () / v1.complex_value ()); } DEFNDBINOP_FN (el_and, complex, matrix, complex, array, mx_el_and)
--- a/libinterp/operators/op-cs-s.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cs-s.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -46,12 +45,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_value () / d); + return octave_value (v1.complex_value () / v2.double_value ()); } DEFBINOP_FN (pow, complex, scalar, xpow) @@ -61,12 +55,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.double_value () / d); + return octave_value (v2.double_value () / v1.complex_value ()); } DEFCMPLXCMPOP_OP (lt, complex, scalar, <) @@ -83,12 +72,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.complex_value () / d); + return octave_value (v1.complex_value () / v2.double_value ()); } DEFBINOP_FN (el_pow, complex, scalar, xpow) @@ -98,12 +82,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.double_value () / d); + return octave_value (v2.double_value () / v1.complex_value ()); } DEFBINOP (el_and, complex, scalar)
--- a/libinterp/operators/op-cs-scm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cs-scm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -51,14 +50,8 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d)); - } + return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () + / v2.complex_value ())); else { MatrixType typ = v2.matrix_type (); @@ -84,12 +77,7 @@ const octave_sparse_complex_matrix& v2 = dynamic_cast<const octave_sparse_complex_matrix&> (a2); - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.sparse_complex_matrix_value () / d); + return octave_value (v2.sparse_complex_matrix_value () / v1.complex_value ()); } DEFBINOP_FN (lt, complex, sparse_complex_matrix, mx_el_lt) @@ -110,15 +98,7 @@ const octave_sparse_complex_matrix& v2 = dynamic_cast<const octave_sparse_complex_matrix&> (a2); - Complex d = v1.complex_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v2.sparse_complex_matrix_value () / d); - - return retval; + return octave_value (v2.sparse_complex_matrix_value () / v1.complex_value ()); } DEFBINOP_FN (el_and, complex, sparse_complex_matrix, mx_el_and)
--- a/libinterp/operators/op-cs-sm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-cs-sm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -52,14 +51,7 @@ const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d)); - } + return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / v2.scalar_value ())); else { MatrixType typ = v2.matrix_type (); @@ -83,15 +75,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); - Complex d = v1.complex_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v2.sparse_matrix_value () / d); - - return retval; + return octave_value (v2.sparse_matrix_value () / v1.complex_value ()); } DEFBINOP_FN (lt, complex, sparse_matrix, mx_el_lt) @@ -110,15 +94,7 @@ const octave_complex& v1 = dynamic_cast<const octave_complex&> (a1); const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); - Complex d = v1.complex_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v2.sparse_matrix_value () / d); - - return retval; + return octave_value (v2.sparse_matrix_value () / v1.complex_value ()); } DEFBINOP_FN (el_and, complex, sparse_matrix, mx_el_and) @@ -136,8 +112,7 @@ { const octave_complex& v = dynamic_cast<const octave_complex&> (a); - return new octave_sparse_matrix - (SparseMatrix (v.matrix_value ())); + return new octave_sparse_matrix (SparseMatrix (v.matrix_value ())); } void
--- a/libinterp/operators/op-dm-scm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-dm-scm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -33,7 +33,6 @@ #include "mx-m-cs.h" #include "mx-cs-m.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -372,14 +371,7 @@ const octave_diag_matrix& v2 = dynamic_cast<const octave_diag_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_complex_matrix_value () / d); - } + return octave_value (v1.sparse_complex_matrix_value () / v2.scalar_value ()); else { MatrixType typ = v2.matrix_type (); @@ -396,14 +388,7 @@ = dynamic_cast<const octave_complex_diag_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - std::complex<double> d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_matrix_value () / d); - } + return octave_value (v1.sparse_matrix_value () / v2.complex_value ()); else { MatrixType typ = v2.matrix_type (); @@ -420,14 +405,7 @@ = dynamic_cast<const octave_complex_diag_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - std::complex<double> d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_complex_matrix_value () / d); - } + return octave_value (v1.sparse_complex_matrix_value () / v2.complex_value ()); else { MatrixType typ = v2.matrix_type ();
--- a/libinterp/operators/op-dm-sm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-dm-sm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -136,14 +135,7 @@ const octave_diag_matrix& v2 = dynamic_cast<const octave_diag_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_matrix_value () / d); - } + return octave_value (v1.sparse_matrix_value () / v2.scalar_value ()); else { MatrixType typ = v2.matrix_type ();
--- a/libinterp/operators/op-dms-template.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-dms-template.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ #endif #include "ops.h" -#include "errwarn.h" #include "xpow.h" #include SINCLUDE #include MINCLUDE @@ -48,22 +47,12 @@ #define MATRIX_VALUE CONCAT2(MATRIXV, _value) #define SCALAR_VALUE CONCAT2(SCALARV, _value) -template <typename T> -static T -gripe_if_zero (T x) -{ - if (x == T ()) - warn_divide_by_zero (); - - return x; -} - DEFBINOP (dmsdiv, MATRIX, SCALAR) { const OCTAVE_MATRIX& v1 = dynamic_cast<const OCTAVE_MATRIX&> (a1); const OCTAVE_SCALAR& v2 = dynamic_cast<const OCTAVE_SCALAR&> (a2); - return v1.MATRIX_VALUE () / gripe_if_zero (v2.SCALAR_VALUE ()); + return v1.MATRIX_VALUE () / v2.SCALAR_VALUE (); } DEFBINOP (sdmldiv, SCALAR, MATRIX) @@ -71,7 +60,7 @@ const OCTAVE_SCALAR& v1 = dynamic_cast<const OCTAVE_SCALAR&> (a1); const OCTAVE_MATRIX& v2 = dynamic_cast<const OCTAVE_MATRIX&> (a2); - return v2.MATRIX_VALUE () / gripe_if_zero (v1.SCALAR_VALUE ()); + return v2.MATRIX_VALUE () / v1.SCALAR_VALUE (); } DEFBINOP (dmspow, MATRIX, SCALAR)
--- a/libinterp/operators/op-fcm-fcs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fcm-fcs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-cx-mat.h" @@ -52,12 +51,7 @@ const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_array_value () / d); + return octave_value (v1.float_complex_array_value () / v2.float_complex_value ()); } DEFBINOP_FN (pow, float_complex_matrix, float_complex, xpow) @@ -101,12 +95,7 @@ const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_array_value () / d); + return octave_value (v1.float_complex_array_value () / v2.float_complex_value ()); } DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex,
--- a/libinterp/operators/op-fcm-fs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fcm-fs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -26,7 +26,6 @@ #include "mx-fcnda-fs.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-cx-mat.h" @@ -55,12 +54,7 @@ const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_array_value () / d); + return octave_value (v1.float_complex_array_value () / v2.float_value ()); } DEFBINOP_FN (pow, float_complex_matrix, float_scalar, xpow) @@ -105,12 +99,7 @@ const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_array_value () / d); + return octave_value (v1.float_complex_array_value () / v2.float_value ()); } DEFNDBINOP_FN (el_pow, float_complex_matrix, float_scalar, float_complex_array,
--- a/libinterp/operators/op-fcs-fcm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fcs-fcm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -71,12 +70,7 @@ const octave_float_complex_matrix& v2 = dynamic_cast<const octave_float_complex_matrix&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_array_value () / d); + return octave_value (v2.float_complex_array_value () / v1.float_complex_value ()); } DEFNDCMPLXCMPOP_FN (lt, float_complex, float_complex_matrix, float_complex, @@ -106,12 +100,7 @@ const octave_float_complex_matrix& v2 = dynamic_cast<const octave_float_complex_matrix&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_array_value () / d); + return octave_value (v2.float_complex_array_value () / v1.float_complex_value ()); } DEFNDBINOP_FN (el_and, float_complex, float_complex_matrix, float_complex,
--- a/libinterp/operators/op-fcs-fcs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fcs-fcs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -73,12 +72,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_value () / d); + return octave_value (v1.float_complex_value () / v2.float_complex_value ()); } DEFBINOP_FN (pow, float_complex, float_complex, xpow) @@ -88,12 +82,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_value () / d); + return octave_value (v2.float_complex_value () / v1.float_complex_value ()); } DEFCMPLXCMPOP_OP (lt, float_complex, float_complex, <) @@ -110,12 +99,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_value () / d); + return octave_value (v1.float_complex_value () / v2.float_complex_value ()); } DEFBINOP_FN (el_pow, float_complex, float_complex, xpow) @@ -125,12 +109,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_value () / d); + return octave_value (v2.float_complex_value () / v1.float_complex_value ()); } DEFBINOP (el_and, float_complex, float_complex)
--- a/libinterp/operators/op-fcs-fm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fcs-fm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -27,7 +27,6 @@ #include "mx-fcs-fnda.h" #include "mx-fnda-fcs.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -69,12 +68,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_matrix& v2 = dynamic_cast<const octave_float_matrix&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_array_value () / d); + return octave_value (v2.float_array_value () / v1.float_complex_value ()); } DEFNDCMPLXCMPOP_FN (lt, float_complex, float_matrix, float_complex, @@ -102,12 +96,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_matrix& v2 = dynamic_cast<const octave_float_matrix&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_array_value () / d); + return octave_value (v2.float_array_value () / v1.float_complex_value ()); } DEFNDBINOP_FN (el_and, float_complex, float_matrix, float_complex,
--- a/libinterp/operators/op-fcs-fs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fcs-fs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-complex.h" @@ -49,12 +48,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_value () / d); + return octave_value (v1.float_complex_value () / v2.float_value ()); } DEFBINOP_FN (pow, float_complex, float_scalar, xpow) @@ -64,12 +58,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_value () / d); + return octave_value (v2.float_value () / v1.float_complex_value ()); } DEFCMPLXCMPOP_OP (lt, float_complex, float_scalar, <) @@ -86,12 +75,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_complex_value () / d); + return octave_value (v1.float_complex_value () / v2.float_value ()); } DEFBINOP_FN (el_pow, float_complex, float_scalar, xpow) @@ -101,12 +85,7 @@ const octave_float_complex& v1 = dynamic_cast<const octave_float_complex&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - FloatComplex d = v1.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v2.float_value () / d); + return octave_value (v2.float_value () / v1.float_complex_value ()); } DEFBINOP (el_and, float_complex, float)
--- a/libinterp/operators/op-fm-fcs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fm-fcs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -29,7 +29,6 @@ #include "mx-fnda-fcs.h" #include "mx-fcs-fnda.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-re-mat.h" @@ -54,12 +53,7 @@ const octave_float_matrix& v1 = dynamic_cast<const octave_float_matrix&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_array_value () / d); + return octave_value (v1.float_array_value () / v2.float_complex_value ()); } DEFBINOP_FN (pow, float_matrix, float_complex, xpow) @@ -100,12 +94,7 @@ const octave_float_matrix& v1 = dynamic_cast<const octave_float_matrix&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_array_value () / d); + return octave_value (v1.float_array_value () / v2.float_complex_value ()); } DEFNDBINOP_FN (el_pow, float_matrix, float_complex, float_array,
--- a/libinterp/operators/op-fm-fs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fm-fs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-flt-re-mat.h" @@ -46,12 +45,7 @@ const octave_float_matrix& v1 = dynamic_cast<const octave_float_matrix&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_array_value () / d); + return octave_value (v1.float_array_value () / v2.float_value ()); } DEFBINOP_FN (pow, float_matrix, float_scalar, xpow) @@ -91,12 +85,7 @@ const octave_float_matrix& v1 = dynamic_cast<const octave_float_matrix&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_array_value () / d); + return octave_value (v1.float_array_value () / v2.float_value ()); } DEFNDBINOP_FN (el_pow, float_matrix, float_scalar, float_array,
--- a/libinterp/operators/op-fs-fcm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fs-fcm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -29,7 +29,6 @@ #include "mx-fs-fcnda.h" #include "mx-fcnda-fs.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -77,12 +76,7 @@ const octave_float_complex_matrix& v2 = dynamic_cast<const octave_float_complex_matrix&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_array_value () / d); + return octave_value (v2.float_complex_array_value () / v1.float_value ()); } DEFNDCMPLXCMPOP_FN (lt, float_scalar, float_complex_matrix, float_scalar, @@ -112,12 +106,7 @@ const octave_float_complex_matrix& v2 = dynamic_cast<const octave_float_complex_matrix&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_array_value () / d); + return octave_value (v2.float_complex_array_value () / v1.float_value ()); } DEFNDBINOP_FN (el_and, float_scalar, float_complex_matrix, float_scalar,
--- a/libinterp/operators/op-fs-fcs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fs-fcs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -49,12 +48,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_value () / d); + return octave_value (v1.float_value () / v2.float_complex_value ()); } DEFBINOP_FN (pow, float_scalar, float_complex, xpow) @@ -64,12 +58,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_value () / d); + return octave_value (v2.float_complex_value () / v1.float_value ()); } DEFCMPLXCMPOP_OP (lt, float_scalar, float_complex, <) @@ -86,12 +75,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - FloatComplex d = v2.float_complex_value (); - - if (d == 0.0f) - warn_divide_by_zero (); - - return octave_value (v1.float_value () / d); + return octave_value (v1.float_value () / v2.float_complex_value ()); } DEFBINOP_FN (el_pow, float_scalar, float_complex, xpow) @@ -101,12 +85,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_complex& v2 = dynamic_cast<const octave_float_complex&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_complex_value () / d); + return octave_value (v2.float_complex_value () / v1.float_value ()); } DEFBINOP (el_and, float_scalar, float_complex)
--- a/libinterp/operators/op-fs-fm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fs-fm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -64,12 +63,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_matrix& v2 = dynamic_cast<const octave_float_matrix&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_array_value () / d); + return octave_value (v2.float_array_value () / v1.float_value ()); } DEFNDBINOP_FN (lt, float_scalar, float_matrix, float_scalar, @@ -97,12 +91,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_matrix& v2 = dynamic_cast<const octave_float_matrix&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_array_value () / d); + return octave_value (v2.float_array_value () / v1.float_value ()); } DEFNDBINOP_FN (el_and, float_scalar, float_matrix, float_scalar,
--- a/libinterp/operators/op-fs-fs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-fs-fs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -26,7 +26,6 @@ #include "Array-util.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -69,12 +68,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_value () / d); + return octave_value (v1.float_value () / v2.float_value ()); } DEFBINOP_FN (pow, float_scalar, float_scalar, xpow) @@ -84,12 +78,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_value () / d); + return octave_value (v2.float_value () / v1.float_value ()); } DEFBINOP_OP (lt, float_scalar, float_scalar, <) @@ -106,12 +95,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v2.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.float_value () / d); + return octave_value (v1.float_value () / v2.float_value ()); } DEFBINOP_FN (el_pow, float_scalar, float_scalar, xpow) @@ -121,12 +105,7 @@ const octave_float_scalar& v1 = dynamic_cast<const octave_float_scalar&> (a1); const octave_float_scalar& v2 = dynamic_cast<const octave_float_scalar&> (a2); - float d = v1.float_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.float_value () / d); + return octave_value (v2.float_value () / v1.float_value ()); } DEFSCALARBOOLOP_OP (el_and, float_scalar, float_scalar, &&)
--- a/libinterp/operators/op-int.h Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-int.h Tue Jan 22 14:34:08 2019 +0100 @@ -198,11 +198,7 @@ const octave_ ## T1 ## scalar& v1 = dynamic_cast<const octave_ ## T1 ## scalar&> (a1); \ const octave_ ## T2 ## scalar& v2 = dynamic_cast<const octave_ ## T2 ## scalar&> (a2); \ \ - if (! v2.T2 ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \ - return retval; \ + return octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \ } \ \ DEFINTBINOP_FN (PFX ## _pow, T1 ## scalar, T2 ## scalar, xpow, T3, ^) \ @@ -212,11 +208,7 @@ const octave_ ## T1 ## scalar& v1 = dynamic_cast<const octave_ ## T1 ## scalar&> (a1); \ const octave_ ## T2 ## scalar& v2 = dynamic_cast<const octave_ ## T2 ## scalar&> (a2); \ \ - if (! v1.T1 ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \ - return retval; \ + return octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \ } \ \ DEFINTBINOP_OP (PFX ## _el_mul, T1 ## scalar, T2 ## scalar, *, T3) \ @@ -226,11 +218,7 @@ const octave_ ## T1 ## scalar& v1 = dynamic_cast<const octave_ ## T1 ## scalar&> (a1); \ const octave_ ## T2 ## scalar& v2 = dynamic_cast<const octave_ ## T2 ## scalar&> (a2); \ \ - if (! v2.T2 ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \ - return retval; \ + return octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \ } \ \ DEFINTBINOP_FN (PFX ## _el_pow, T1 ## scalar, T2 ## scalar, xpow, T3, .^) \ @@ -240,11 +228,7 @@ const octave_ ## T1 ## scalar& v1 = dynamic_cast<const octave_ ## T1 ## scalar&> (a1); \ const octave_ ## T2 ## scalar& v2 = dynamic_cast<const octave_ ## T2 ## scalar&> (a2); \ \ - if (! v1.T1 ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \ - return retval; \ + return octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \ } #define OCTAVE_SS_INT_BOOL_OPS(PFX, T1, T2, Z1, Z2) \ @@ -347,11 +331,7 @@ const octave_ ## TS ## scalar& v1 = dynamic_cast<const octave_ ## TS ## scalar&> (a1); \ const octave_ ## TM ## matrix& v2 = dynamic_cast<const octave_ ## TM ## matrix&> (a2); \ \ - if (! v1.TS ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \ - return retval; \ + return octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \ } \ \ DEFINTNDBINOP_OP (PFX ## _el_mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \ @@ -371,11 +351,7 @@ const octave_ ## TS ## scalar& v1 = dynamic_cast<const octave_ ## TS ## scalar&> (a1); \ const octave_ ## TM ## matrix& v2 = dynamic_cast<const octave_ ## TM ## matrix&> (a2); \ \ - if (! v1.TS ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \ - return retval; \ + return octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \ } #define OCTAVE_SM_INT_CMP_OPS(PFX, TS, TM) \ @@ -494,11 +470,7 @@ const octave_ ## TM ## matrix& v1 = dynamic_cast<const octave_ ## TM ## matrix&> (a1); \ const octave_ ## TS ## scalar& v2 = dynamic_cast<const octave_ ## TS ## scalar&> (a2); \ \ - if (! v2.TS ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \ - return retval; \ + return octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \ } \ \ /* DEFBINOP_FN (PFX ## _pow, TM ## matrix, TS ## scalar, xpow) */ \ @@ -521,11 +493,7 @@ const octave_ ## TM ## matrix& v1 = dynamic_cast<const octave_ ## TM ## matrix&> (a1); \ const octave_ ## TS ## scalar& v2 = dynamic_cast<const octave_ ## TS ## scalar&> (a2); \ \ - if (! v2.TS ## scalar_value ()) \ - warn_divide_by_zero (); \ - \ - octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \ - return retval; \ + return octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \ } \ \ DEFINTNDBINOP_FN (PFX ## _el_pow, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, elem_xpow, TI, .^) \
--- a/libinterp/operators/op-m-cs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-m-cs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -29,7 +29,6 @@ #include "mx-nda-cs.h" #include "mx-cs-nda.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-re-mat.h" @@ -53,12 +52,7 @@ const octave_matrix& v1 = dynamic_cast<const octave_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.array_value () / d); + return octave_value (v1.array_value () / v2.complex_value ()); } DEFBINOP_FN (pow, matrix, complex, xpow) @@ -92,12 +86,7 @@ const octave_matrix& v1 = dynamic_cast<const octave_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.array_value () / d); + return octave_value (v1.array_value () / v2.complex_value ()); } DEFNDBINOP_FN (el_pow, matrix, complex, array, complex, elem_xpow)
--- a/libinterp/operators/op-m-s.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-m-s.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-re-mat.h" @@ -47,12 +46,7 @@ const octave_matrix& v1 = dynamic_cast<const octave_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.array_value () / d); + return octave_value (v1.array_value () / v2.double_value ()); } DEFBINOP_FN (pow, matrix, scalar, xpow) @@ -86,12 +80,7 @@ const octave_matrix& v1 = dynamic_cast<const octave_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.array_value () / d); + return octave_value (v1.array_value () / v2.double_value ()); } DEFNDBINOP_FN (el_pow, matrix, scalar, array, scalar, elem_xpow)
--- a/libinterp/operators/op-m-scm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-m-scm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -54,14 +53,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.array_value () / d); - } + return octave_value (v1.array_value () / v2.complex_value ()); else { MatrixType typ = v2.matrix_type ();
--- a/libinterp/operators/op-m-sm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-m-sm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -52,14 +51,7 @@ const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.array_value () / d); - } + return octave_value (v1.array_value () / v2.scalar_value ()); else { MatrixType typ = v2.matrix_type ();
--- a/libinterp/operators/op-s-cm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-s-cm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -29,7 +29,6 @@ #include "mx-s-cnda.h" #include "mx-cnda-s.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -72,12 +71,7 @@ const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_array_value () / d); + return octave_value (v2.complex_array_value () / v1.double_value ()); } DEFNDCMPLXCMPOP_FN (lt, scalar, complex_matrix, scalar, complex_array, mx_el_lt) @@ -97,12 +91,7 @@ const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_array_value () / d); + return octave_value (v2.complex_array_value () / v1.double_value ()); } DEFNDBINOP_FN (el_and, scalar, complex_matrix, scalar, complex_array, mx_el_and)
--- a/libinterp/operators/op-s-cs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-s-cs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -48,12 +47,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.double_value () / d); + return octave_value (v1.double_value () / v2.complex_value ()); } DEFBINOP_FN (pow, scalar, complex, xpow) @@ -63,12 +57,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_value () / d); + return octave_value (v2.complex_value () / v1.double_value ()); } DEFCMPLXCMPOP_OP (lt, scalar, complex, <) @@ -85,12 +74,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.double_value () / d); + return octave_value (v1.double_value () / v2.complex_value ()); } DEFBINOP_FN (el_pow, scalar, complex, xpow) @@ -100,12 +84,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_value () / d); + return octave_value (v2.complex_value () / v1.double_value ()); } DEFBINOP (el_and, scalar, complex)
--- a/libinterp/operators/op-s-m.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-s-m.cc Tue Jan 22 14:34:08 2019 +0100 @@ -24,7 +24,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -64,12 +63,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.array_value () / d); + return octave_value (v2.array_value () / v1.double_value ()); } DEFNDBINOP_FN (lt, scalar, matrix, scalar, array, mx_el_lt) @@ -88,12 +82,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.array_value () / d); + return octave_value (v2.array_value () / v1.double_value ()); } DEFNDBINOP_FN (el_and, scalar, matrix, scalar, array, mx_el_and)
--- a/libinterp/operators/op-s-s.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-s-s.cc Tue Jan 22 14:34:08 2019 +0100 @@ -26,7 +26,6 @@ #include "Array-util.h" -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-scalar.h" @@ -70,12 +69,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.double_value () / d); + return octave_value (v1.double_value () / v2.double_value ()); } DEFBINOP_FN (pow, scalar, scalar, xpow) @@ -85,12 +79,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.double_value () / d); + return octave_value (v2.double_value () / v1.double_value ()); } DEFBINOP_OP (lt, scalar, scalar, <) @@ -107,12 +96,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.double_value () / d); + return octave_value (v1.double_value () / v2.double_value ()); } DEFBINOP_FN (el_pow, scalar, scalar, xpow) @@ -122,12 +106,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.double_value () / d); + return octave_value (v2.double_value () / v1.double_value ()); } DEFSCALARBOOLOP_OP (el_and, scalar, scalar, &&)
--- a/libinterp/operators/op-s-scm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-s-scm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -54,14 +53,8 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseComplexMatrix (1, 1, v1.scalar_value () / d)); - } + return octave_value (SparseComplexMatrix (1, 1, v1.scalar_value () + / v2.complex_value ())); else { MatrixType typ = v2.matrix_type (); @@ -87,15 +80,7 @@ const octave_sparse_complex_matrix& v2 = dynamic_cast<const octave_sparse_complex_matrix&> (a2); - double d = v1.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v2.sparse_complex_matrix_value () / d); - - return retval; + return octave_value (v2.sparse_complex_matrix_value () / v1.double_value ()); } DEFBINOP_FN (lt, scalar, sparse_complex_matrix, mx_el_lt) @@ -115,15 +100,7 @@ const octave_sparse_complex_matrix& v2 = dynamic_cast<const octave_sparse_complex_matrix&> (a2); - double d = v1.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v2.sparse_complex_matrix_value () / d); - - return retval; + return octave_value (v2.sparse_complex_matrix_value () / v1.double_value ()); } DEFBINOP_FN (el_and, scalar, sparse_complex_matrix, mx_el_and)
--- a/libinterp/operators/op-s-sm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-s-sm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -49,14 +48,7 @@ const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseMatrix (1, 1, v1.scalar_value () / d)); - } + return octave_value (SparseMatrix (1, 1, v1.scalar_value () / v2.scalar_value ())); else { MatrixType typ = v2.matrix_type (); @@ -80,15 +72,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); - double d = v1.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v2.sparse_matrix_value () / d); - - return retval; + return octave_value (v2.sparse_matrix_value () / v1.double_value ()); } DEFBINOP_FN (lt, scalar, sparse_matrix, mx_el_lt) @@ -107,15 +91,7 @@ const octave_scalar& v1 = dynamic_cast<const octave_scalar&> (a1); const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); - double d = v1.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v2.sparse_matrix_value () / d); - - return retval; + return octave_value (v2.sparse_matrix_value () / v1.double_value ()); } DEFBINOP_FN (el_and, scalar, sparse_matrix, mx_el_and)
--- a/libinterp/operators/op-scm-cm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-scm-cm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -74,14 +73,7 @@ = dynamic_cast<const octave_complex_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_array_value () / d); - } + return octave_value (v2.complex_array_value () / v1.complex_value ()); else { MatrixType typ = v1.matrix_type ();
--- a/libinterp/operators/op-scm-cs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-scm-cs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -50,15 +49,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_complex_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_complex_matrix_value () / v2.complex_value ()); } DEFBINOP (pow, sparse_complex_matrix, complex) @@ -76,14 +67,8 @@ const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () / d)); - } + return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () + / v1.complex_value ())); else { MatrixType typ = v1.matrix_type (); @@ -110,16 +95,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - octave_value retval; - - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_complex_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_complex_matrix_value () / v2.complex_value ()); } DEFBINOP_FN (el_pow, sparse_complex_matrix, complex, elem_xpow)
--- a/libinterp/operators/op-scm-m.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-scm-m.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -73,14 +72,7 @@ const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.array_value () / d); - } + return octave_value (v2.array_value () / v1.complex_value ()); else { MatrixType typ = v1.matrix_type ();
--- a/libinterp/operators/op-scm-s.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-scm-s.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -53,15 +52,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_complex_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_complex_matrix_value () / v2.double_value ()); } DEFBINOP (pow, sparse_complex_matrix, scalar) @@ -84,14 +75,8 @@ const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseComplexMatrix (1, 1, v2.scalar_value () / d)); - } + return octave_value (SparseComplexMatrix (1, 1, v2.scalar_value () + / v1.complex_value ())); else { MatrixType typ = v1.matrix_type (); @@ -118,15 +103,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_complex_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_complex_matrix_value () / v2.double_value ()); } DEFBINOP_FN (el_pow, sparse_complex_matrix, scalar, elem_xpow)
--- a/libinterp/operators/op-scm-scm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-scm-scm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -34,15 +33,10 @@ #include "sparse-xdiv.h" #include "sparse-xpow.h" +#include "ov-cx-mat.h" +#include "ov-cx-sparse.h" #include "ov-re-sparse.h" -#include "ov-cx-sparse.h" -#include "errwarn.h" -#include "ovl.h" -#include "ov.h" -#include "ov-cx-mat.h" -#include "ov-typeinfo.h" -#include "ops.h" #include "xdiv.h" #include "xpow.h" @@ -70,24 +64,6 @@ v.matrix_type ().transpose ()); } -#if 0 -DEFUNOP (incr, sparse_complex_matrix) -{ - const octave_sparse_complex_matrix& v - = dynamic_cast<const octave_sparse_complex_matrix&> (a); - - return octave_value (v.complex_matrix_value () .increment ()); -} - -DEFUNOP (decr, sparse_complex_matrix) -{ - const octave_sparse_complex_matrix& v - = dynamic_cast<const octave_sparse_complex_matrix&> (a); - - return octave_value (v.complex_matrix_value () .decrement ()); -} -#endif - // complex matrix by complex matrix ops. DEFBINOP_OP (add, sparse_complex_matrix, sparse_complex_matrix, +) @@ -103,14 +79,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_complex_matrix_value () / d); - } + return octave_value (v1.sparse_complex_matrix_value () / v2.complex_value ()); else { MatrixType typ = v2.matrix_type (); @@ -135,14 +104,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.sparse_complex_matrix_value () / d); - } + return octave_value (v2.sparse_complex_matrix_value () / v1.complex_value ()); else { MatrixType typ = v1.matrix_type (); @@ -196,11 +158,6 @@ INSTALL_UNOP_TI (ti, op_transpose, octave_sparse_complex_matrix, transpose); INSTALL_UNOP_TI (ti, op_hermitian, octave_sparse_complex_matrix, hermitian); -#if 0 - INSTALL_NCUNOP_TI (ti, op_incr, octave_sparse_complex_matrix, incr); - INSTALL_NCUNOP_TI (ti, op_decr, octave_sparse_complex_matrix, decr); -#endif - INSTALL_BINOP_TI (ti, op_add, octave_sparse_complex_matrix, octave_sparse_complex_matrix, add); INSTALL_BINOP_TI (ti, op_sub, octave_sparse_complex_matrix,
--- a/libinterp/operators/op-scm-sm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-scm-sm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -53,14 +52,7 @@ = dynamic_cast<const octave_sparse_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_complex_matrix_value () / d); - } + return octave_value (v1.sparse_complex_matrix_value () / v2.scalar_value ()); else { MatrixType typ = v2.matrix_type (); @@ -85,14 +77,7 @@ = dynamic_cast<const octave_sparse_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - Complex d = v1.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.sparse_matrix_value () / d); - } + return octave_value (v2.sparse_matrix_value () / v1.complex_value ()); else { MatrixType typ = v1.matrix_type ();
--- a/libinterp/operators/op-sm-cm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-sm-cm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -74,14 +73,7 @@ = dynamic_cast<const octave_complex_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - double d = v1.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.complex_array_value () / d); - } + return octave_value (v2.complex_array_value () / v1.scalar_value ()); else { MatrixType typ = v1.matrix_type ();
--- a/libinterp/operators/op-sm-cs.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-sm-cs.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -51,15 +50,7 @@ const octave_sparse_matrix& v1 = dynamic_cast<const octave_sparse_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_matrix_value () / v2.complex_value ()); } DEFBINOP (pow, sparse_matrix, complex) @@ -75,14 +66,8 @@ const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - double d = v1.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () / d)); - } + return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () + / v1.scalar_value ())); else { MatrixType typ = v1.matrix_type (); @@ -108,15 +93,7 @@ const octave_sparse_matrix& v1 = dynamic_cast<const octave_sparse_matrix&> (a1); const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2); - Complex d = v2.complex_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_matrix_value () / v2.complex_value ()); } DEFBINOP_FN (el_pow, sparse_matrix, complex, elem_xpow)
--- a/libinterp/operators/op-sm-m.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-sm-m.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -69,14 +68,7 @@ const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - double d = v1.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.array_value () / d); - } + return octave_value (v2.array_value () / v1.scalar_value ()); else { MatrixType typ = v1.matrix_type ();
--- a/libinterp/operators/op-sm-s.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-sm-s.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -48,15 +47,7 @@ const octave_sparse_matrix& v1 = dynamic_cast<const octave_sparse_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_matrix_value () / v2.double_value ()); } DEFBINOP (pow, sparse_matrix, scalar) @@ -77,14 +68,7 @@ const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - double d = v1.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (SparseMatrix(1, 1, v2.scalar_value () / d)); - } + return octave_value (SparseMatrix(1, 1, v2.scalar_value () / v1.scalar_value ())); else { MatrixType typ = v1.matrix_type (); @@ -110,15 +94,7 @@ const octave_sparse_matrix& v1 = dynamic_cast<const octave_sparse_matrix&> (a1); const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2); - double d = v2.double_value (); - octave_value retval; - - if (d == 0.0) - warn_divide_by_zero (); - - retval = octave_value (v1.sparse_matrix_value () / d); - - return retval; + return octave_value (v1.sparse_matrix_value () / v2.double_value ()); } DEFBINOP_FN (el_pow, sparse_matrix, scalar, elem_xpow)
--- a/libinterp/operators/op-sm-scm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-sm-scm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -53,14 +52,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - Complex d = v2.complex_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_matrix_value () / d); - } + return octave_value (v1.sparse_matrix_value () / v2.complex_value ()); else { MatrixType typ = v2.matrix_type (); @@ -85,14 +77,7 @@ = dynamic_cast<const octave_sparse_complex_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - double d = v1.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.sparse_complex_matrix_value () / d); - } + return octave_value (v2.sparse_complex_matrix_value () / v1.scalar_value ()); else { MatrixType typ = v1.matrix_type ();
--- a/libinterp/operators/op-sm-sm.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/operators/op-sm-sm.cc Tue Jan 22 14:34:08 2019 +0100 @@ -25,7 +25,6 @@ # include "config.h" #endif -#include "errwarn.h" #include "ovl.h" #include "ov.h" #include "ov-typeinfo.h" @@ -76,14 +75,7 @@ const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); if (v2.rows () == 1 && v2.columns () == 1) - { - double d = v2.scalar_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v1.sparse_matrix_value () / d); - } + return octave_value (v1.sparse_matrix_value () / v2.scalar_value ()); else { MatrixType typ = v2.matrix_type (); @@ -106,14 +98,7 @@ const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2); if (v1.rows () == 1 && v1.columns () == 1) - { - double d = v1.double_value (); - - if (d == 0.0) - warn_divide_by_zero (); - - return octave_value (v2.sparse_matrix_value () / d); - } + return octave_value (v2.sparse_matrix_value () / v1.double_value ()); else { MatrixType typ = v1.matrix_type ();
--- a/libinterp/parse-tree/jit-typeinfo.cc Tue Jan 22 08:07:55 2019 -0500 +++ b/libinterp/parse-tree/jit-typeinfo.cc Tue Jan 22 14:34:08 2019 +0100 @@ -386,10 +386,6 @@ extern "C" Complex octave_jit_complex_div (Complex lhs, Complex rhs) { - // see src/OPERATORS/op-cs-cs.cc - if (rhs == 0.0) - warn_divide_by_zero (); - return lhs / rhs; } @@ -1355,10 +1351,6 @@ add_binary_fcmp (m_scalar, octave_value::op_gt, llvm::CmpInst::FCMP_UGT); add_binary_fcmp (m_scalar, octave_value::op_ne, llvm::CmpInst::FCMP_UNE); - jit_function gripe_div0 = create_external (JIT_FN (warn_divide_by_zero), - nullptr); - gripe_div0.mark_can_error (); - // divide is annoying because it might error fn = create_internal ("octave_jit_div_scalar_scalar", m_scalar, m_scalar, m_scalar); @@ -1376,7 +1368,6 @@ m_builder.CreateCondBr (check, warn_block, normal_block); m_builder.SetInsertPoint (warn_block); - gripe_div0.call (m_builder); m_builder.CreateBr (normal_block); m_builder.SetInsertPoint (normal_block);
--- a/scripts/general/quadgk.m Tue Jan 22 08:07:55 2019 -0500 +++ b/scripts/general/quadgk.m Tue Jan 22 14:34:08 2019 +0100 @@ -318,10 +318,6 @@ endwhile subs = [subs(1:end-1), subs(2:end)]; - ## Singularity will cause divide by zero warnings. - ## Turn off warning locally for quadgk function only. - warning ("off", "Octave:divide-by-zero", "local"); - warn_id = "Octave:quadgk:warning-termination"; if (issingle)
--- a/scripts/general/quadv.m Tue Jan 22 08:07:55 2019 -0500 +++ b/scripts/general/quadv.m Tue Jan 22 14:34:08 2019 +0100 @@ -152,18 +152,14 @@ %!assert (quadv (@sin, 0, pi), 2, 1e-6) ## Test weak singularities at the edge -%!test -%! warning ("off", "Octave:divide-by-zero", "local"); -%! assert (quadv (@(x) 1 ./ sqrt (x), 0, 1), 2, 2e-6); +%!assert (quadv (@(x) 1 ./ sqrt (x), 0, 1), 2, 2e-6); ## Test vector-valued functions %!assert (quadv (@(x) [(sin (x)), (sin (2 * x))], 0, pi), [2, 0], 1e-6) ## Test matrix-valued functions -%!test -%! warning ("off", "Octave:divide-by-zero", "local"); -%! assert (quadv (@(x) [ x,x,x; x,1./sqrt(x),x; x,x,x ], 0, 1), -%! [0.5,0.5,0.5; 0.5,2,0.5; 0.5,0.5,0.5], 2e-6); +%!assert (quadv (@(x) [ x,x,x; x,1./sqrt(x),x; x,x,x ], 0, 1), +%! [0.5,0.5,0.5; 0.5,2,0.5; 0.5,0.5,0.5], 2e-6); ## Test input validation %!error quadv ()
--- a/scripts/help/warning_ids.m Tue Jan 22 08:07:55 2019 -0500 +++ b/scripts/help/warning_ids.m Tue Jan 22 14:34:08 2019 +0100 @@ -158,11 +158,6 @@ ## is obsolete and scheduled for removal from Octave. ## By default, the @code{Octave:deprecated-property} warning is enabled. ## -## @item Octave:divide-by-zero -## If the @code{Octave:divide-by-zero} warning is enabled, a -## warning is issued when Octave encounters a division by zero. -## By default, the @code{Octave:divide-by-zero} warning is enabled. -## ## @item Octave:eigs:UnconvergedEigenvalues ## If the @code{Octave:eigs:UnconvergedEigenvalues} warning is enabled then ## the eigs function will issue a warning if the number of calculated
--- a/scripts/statistics/kurtosis.m Tue Jan 22 08:07:55 2019 -0500 +++ b/scripts/statistics/kurtosis.m Tue Jan 22 14:34:08 2019 +0100 @@ -153,9 +153,8 @@ %!assert (kurtosis (single ([1:5 10])), single (2.9786513), eps ("single")) %!assert (kurtosis (single ([1 2]), 0), single (NaN)) -## Verify no "divide-by-zero" warnings +## Verify no warnings %!test -%! warning ("on", "Octave:divide-by-zero", "local"); %! lastwarn (""); # clear last warning %! kurtosis (1); %! assert (lastwarn (), "");
--- a/scripts/statistics/mean.m Tue Jan 22 08:07:55 2019 -0500 +++ b/scripts/statistics/mean.m Tue Jan 22 14:34:08 2019 +0100 @@ -142,10 +142,6 @@ print_usage (); endswitch - ## FIXME: Delete this when the "divide-by-zero" warning is - ## removed in Octave 6.0. - warning ("off", "Octave:divide-by-zero", "local"); - ## The actual mean computation n = size (x, dim); switch (mean_type)
--- a/scripts/statistics/skewness.m Tue Jan 22 08:07:55 2019 -0500 +++ b/scripts/statistics/skewness.m Tue Jan 22 14:34:08 2019 +0100 @@ -152,9 +152,8 @@ %!assert (skewness (single ([1:5 10])), single (1.0513283), eps ("single")) %!assert (skewness (single ([1 2]), 0), single (NaN)) -## Verify no "divide-by-zero" warnings +## Verify no warnings %!test -%! warning ("on", "Octave:divide-by-zero", "local"); %! lastwarn (""); # clear last warning %! skewness (1); %! assert (lastwarn (), "");
--- a/test/jit.tst Tue Jan 22 08:07:55 2019 -0500 +++ b/test/jit.tst Tue Jan 22 14:34:08 2019 +0100 @@ -377,15 +377,11 @@ %! assert (jit_failcnt, 0); %!function test_divide () -%! state = warning ("query", "Octave:divide-by-zero").state; %! unwind_protect -%! warning ("error", "Octave:divide-by-zero"); %! for i=1:1e5 %! a = 1; %! a / 0; %! endfor -%! unwind_protect_cleanup -%! warning (state, "Octave:divide-by-zero"); %! end_unwind_protect %!endfunction
--- a/test/mk-sparse-tst.sh Tue Jan 22 08:07:55 2019 -0500 +++ b/test/mk-sparse-tst.sh Tue Jan 22 14:34:08 2019 +0100 @@ -209,12 +209,7 @@ %!assert (nnz (sparse (1,1,0)), 0) %!assert (nnz (sparse (eye (3))*0), 0) %!assert (nnz (sparse (eye (3))-sparse (eye (3))), 0) - -%!test -%! wdbz = warning ("query", "Octave:divide-by-zero"); -%! warning ("off", "Octave:divide-by-zero"); -%! assert (full (sparse (eye (3))/0), full (eye (3)/0)); -%! warning (wdbz.state, "Octave:divide-by-zero"); +%!assert (full (sparse (eye (3))/0), full (eye (3)/0)); EOF }
--- a/test/prefer.tst Tue Jan 22 08:07:55 2019 -0500 +++ b/test/prefer.tst Tue Jan 22 14:34:08 2019 +0100 @@ -176,15 +176,9 @@ %! warning (watv.state, "Octave:assign-as-truth-value"); %!test -%! wdbz = warning ("query", "Octave:divide-by-zero"); -%! warning ("off", "Octave:divide-by-zero"); %! assert (isinf (1/0)); -%! warning (wdbz.state, "Octave:divide-by-zero"); %!test -%! wdbz = warning ("query", "Octave:divide-by-zero"); -%! warning ("on", "Octave:divide-by-zero"); %! a = 1; %! b = 0; -%! fail ("isinf (a/b);", "warning", "division by zero"); -%! warning (wdbz.state, "Octave:divide-by-zero"); +%! assert (isinf (a/b));