Mercurial > octave
diff libinterp/operators/op-fcs-fs.cc @ 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".
author | Kai T. Ohlhus <k.ohlhus@gmail.com> |
---|---|
date | Tue, 22 Jan 2019 14:34:08 +0100 |
parents | 00f796120a6d |
children | b442ec6dda5c |
line wrap: on
line diff
--- 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)