Mercurial > octave
diff liboctave/numeric/lo-mappers.h @ 23564:7049da1648c0
Deprecate octave::math::finite in favor of octave::math::isfinite.
New name matches is clearer about what function does as it matches both
Octave's m-file language and C++11.
* lo-mappers.h (isfinite): Declare new function isfinite for double, float, and
std::complex types. Use OCTAVE_DEPRECATED macro for declarations of finite
function. Replace uses of octave::math::finite with octave::math::isfinite.
* lo-mappers.cc (isfinite): Implement new function isfinite for double and float
types.
* lo-mappers.cc (finite): Delete function finite for double and float types.
* gl-render.cc, graphics.cc, graphics.in.h, ls-mat5.cc, pr-output.cc,
quadcc.cc, ov-complex.cc, ov-cx-sparse.cc, ov-float.cc, ov-flt-complex.cc,
ov-re-sparse.cc, ov-scalar.cc, CNDArray.cc, Range.h, dNDArray.cc, fCNDArray.cc,
fNDArray.cc, lo-specfun.cc, oct-rand.cc, mx-inlines.cc, lo-utils.cc:
Replace uses of octave::math::finite with octave::math::isfinite.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 08 Jun 2017 15:56:46 -0700 |
parents | 3530b956d707 |
children | 7a97944f06e5 |
line wrap: on
line diff
--- a/liboctave/numeric/lo-mappers.h Thu Jun 08 18:21:07 2017 -0400 +++ b/liboctave/numeric/lo-mappers.h Thu Jun 08 15:56:46 2017 -0700 @@ -232,14 +232,27 @@ return (isnan (std::real (x)) || isnan (std::imag (x))); } - extern OCTAVE_API bool finite (double x); - extern OCTAVE_API bool finite (float x); + extern OCTAVE_API bool isfinite (double x); + extern OCTAVE_API bool isfinite (float x); template <typename T> bool + isfinite (const std::complex<T>& x) + { + return (isfinite (std::real (x)) && isfinite (std::imag (x))); + } + + OCTAVE_DEPRECATED ("use 'octave::math::isfinite' instead") + inline bool finite (double x) { return octave::math::isfinite (x); } + OCTAVE_DEPRECATED ("use 'octave::math::isfinite' instead") + inline bool finite (float x) { return octave::math::isfinite (x); } + + template <typename T> + OCTAVE_DEPRECATED ("use 'octave::math::isfinite' instead") + bool finite (const std::complex<T>& x) { - return (finite (std::real (x)) && finite (std::imag (x))); + return octave::math::isfinite (x); } extern OCTAVE_API bool isinf (double x); @@ -255,8 +268,8 @@ // Some useful tests, that are commonly repeated. // Test for a finite integer. - inline bool isinteger (double x) { return finite (x) && x == round (x); } - inline bool isinteger (float x) { return finite (x) && x == round (x); } + inline bool isinteger (double x) { return isfinite (x) && x == round (x); } + inline bool isinteger (float x) { return isfinite (x) && x == round (x); } inline double signum (double x) @@ -307,13 +320,13 @@ template <> inline double x_nint (double x) { - return (finite (x) ? floor (x + 0.5) : x); + return (isfinite (x) ? floor (x + 0.5) : x); } template <> inline float x_nint (float x) { - return (finite (x) ? floor (x + 0.5f) : x); + return (isfinite (x) ? floor (x + 0.5f) : x); } extern OCTAVE_API octave_idx_type nint_big (double x); @@ -752,17 +765,17 @@ return octave::math::isnan (x); } -OCTAVE_DEPRECATED ("use 'octave::math::finite' instead") -inline bool xfinite (double x) { return octave::math::finite (x); } -OCTAVE_DEPRECATED ("use 'octave::math::finite' instead") -inline bool xfinite (float x) { return octave::math::finite (x); } +OCTAVE_DEPRECATED ("use 'octave::math::isfinite' instead") +inline bool xfinite (double x) { return octave::math::isfinite (x); } +OCTAVE_DEPRECATED ("use 'octave::math::isfinite' instead") +inline bool xfinite (float x) { return octave::math::isfinite (x); } template <typename T> -OCTAVE_DEPRECATED ("use 'octave::math::finite' instead") +OCTAVE_DEPRECATED ("use 'octave::math::isfinite' instead") bool xfinite (const std::complex<T>& x) { - return octave::math::finite (x); + return octave::math::isfinite (x); } OCTAVE_DEPRECATED ("use 'octave::math::isinf' instead")