Mercurial > octave
changeset 23643:3dc16b35ba2c
Use round, roundf, roundl from C++ std library.
These functions are guaranteed to be part of C++11 standard library.
* configure.ac: Remove AC_CHECK_FUNCS, AC_CHECK_DECLS for round.
* lo-mappers.cc: Delegate to std::round or std::roundf.
* oct-inttypes.h: #include <cmath>. Delegate to std::roundl.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 19 Jun 2017 09:09:27 -0700 |
parents | 18ae8d3c745b |
children | 3177e276e60f |
files | configure.ac liboctave/numeric/lo-mappers.cc liboctave/util/oct-inttypes.h |
diffstat | 3 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Sun Jun 18 21:55:12 2017 -0700 +++ b/configure.ac Mon Jun 19 09:09:27 2017 -0700 @@ -2421,15 +2421,12 @@ ## exp2, round, tgamma function checks AC_LANG_PUSH(C++) -AC_CHECK_DECLS([round, tgamma], [], [], [[#include <cmath>]]) -AC_CHECK_FUNCS([round tgamma]) +AC_CHECK_DECLS([tgamma], [], [], [[#include <cmath>]]) +AC_CHECK_FUNCS([tgamma]) AH_VERBATIM([Z_FUNCS_AND_DECLS], [ #if defined (__cplusplus) extern "C" { #endif -#if HAVE_ROUND && ! HAVE_DECL_ROUND -double round (double); -#endif #if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA double tgamma (double); #endif
--- a/liboctave/numeric/lo-mappers.cc Sun Jun 18 21:55:12 2017 -0700 +++ b/liboctave/numeric/lo-mappers.cc Mon Jun 19 09:09:27 2017 -0700 @@ -293,7 +293,7 @@ float floor (float x) { return std::floor (x); } double round (double x) { return std::round (x); } - float round (float x) { return std::round (x); } + float round (float x) { return std::roundf (x); } double frexp (double x, int *expptr) {
--- a/liboctave/util/oct-inttypes.h Sun Jun 18 21:55:12 2017 -0700 +++ b/liboctave/util/oct-inttypes.h Mon Jun 19 09:09:27 2017 -0700 @@ -26,6 +26,7 @@ #include "octave-config.h" +#include <cmath> #include <cstdlib> #include <iosfwd> @@ -53,7 +54,7 @@ { namespace math { - inline long double round (long double x) { return roundl (x); } + inline long double round (long double x) { return std::roundl (x); } inline long double isnan (long double x) { return isnan (static_cast<double> (x)); } }