Mercurial > octave-nkf
changeset 18881:ff4da3c8ed16 stable
use gnulib log2 modules (bug #42583)
* bootstrap.conf (gnulib_modules): Include log2, log2f, log2-ieee, and
log2f-ieee, in the list.
* lo-mappers.cc (xlog2): Use gnulib:: versions of log2 and log2f.
* CMatrix.cc, dMatrix.cc, fCMatrix.cc, fMatrix.cc: Use xlog2.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 19 Jun 2014 15:49:14 -0400 |
parents | 161b11e7da2d |
children | b314efd58072 9d185537e5d1 |
files | bootstrap.conf liboctave/array/CMatrix.cc liboctave/array/dMatrix.cc liboctave/array/fCMatrix.cc liboctave/array/fMatrix.cc liboctave/numeric/lo-mappers.cc |
diffstat | 6 files changed, 22 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/bootstrap.conf Thu Jun 19 09:41:12 2014 -0700 +++ b/bootstrap.conf Thu Jun 19 15:49:14 2014 -0400 @@ -50,6 +50,10 @@ isatty largefile link + log2 + log2-ieee + log2f + log2f-ieee lstat malloc-gnu mbrtowc
--- a/liboctave/array/CMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/CMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2683,11 +2683,8 @@ // call. double dminmn = static_cast<double> (minmn); double dsmlsizp1 = static_cast<double> (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2875,11 +2872,8 @@ // call. double dminmn = static_cast<double> (minmn); double dsmlsizp1 = static_cast<double> (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0;
--- a/liboctave/array/dMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/dMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2320,11 +2320,8 @@ // of LAPACK does not return it on a query call. double dminmn = static_cast<double> (minmn); double dsmlsizp1 = static_cast<double> (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2511,11 +2508,8 @@ // of LAPACK does not return it on a query call. double dminmn = static_cast<double> (minmn); double dsmlsizp1 = static_cast<double> (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0;
--- a/liboctave/array/fCMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/fCMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2699,11 +2699,8 @@ // call. float dminmn = static_cast<float> (minmn); float dsmlsizp1 = static_cast<float> (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2894,11 +2891,8 @@ // call. float dminmn = static_cast<float> (minmn); float dsmlsizp1 = static_cast<float> (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0;
--- a/liboctave/array/fMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/fMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2340,11 +2340,8 @@ // of LAPACK does not return it on a query call. float dminmn = static_cast<float> (minmn); float dsmlsizp1 = static_cast<float> (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2531,11 +2528,8 @@ // of LAPACK does not return it on a query call. float dminmn = static_cast<float> (minmn); float dsmlsizp1 = static_cast<float> (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast<octave_idx_type> (tmp) + 1; if (nlvl < 0) nlvl = 0;
--- a/liboctave/numeric/lo-mappers.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/numeric/lo-mappers.cc Thu Jun 19 15:49:14 2014 -0400 @@ -92,17 +92,7 @@ double xlog2 (double x) { -#if defined (HAVE_LOG2) - return log2 (x); -#else -#if defined (M_LN2) - static double ln2 = M_LN2; -#else - static double ln2 = log (2); -#endif - - return log (x) / ln2; -#endif + return gnulib::log2 (x); } Complex @@ -317,19 +307,7 @@ float xlog2 (float x) { -#if defined (HAVE_LOG2F) - return log2f (x); -#elif defined (HAVE_LOG2) - return log2 (x); -#else -#if defined (M_LN2) - static float ln2 = M_LN2; -#else - static float ln2 = log2 (2); -#endif - - return log (x) / ln2; -#endif + return gnulib::log2f (x); } FloatComplex