Mercurial > hg > octave-terminal
changeset 11978:5d0dcd492f9f release-3-2-x
fix log2 with 2 outargs, loosen tests to meet IEEE
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 09 Jun 2009 07:18:28 +0200 |
parents | 854863bb29e8 |
children | ba624b9b7679 |
files | liboctave/ChangeLog liboctave/lo-mappers.cc src/ChangeLog src/data.cc |
diffstat | 4 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2009-06-09 Jaroslav Hajek <highegg@gmail.com> + + * lo-mappers.cc (xlog2 (const Complex&, int&), xlog2 (const + FloatComplex&, int&)): Use more robust expression. + 2009-06-07 Jaroslav Hajek <highegg@gmail.com> * Array.cc (Array<T>::find): Avoid allocating excessive memory. Fix
--- a/liboctave/lo-mappers.cc +++ b/liboctave/lo-mappers.cc @@ -185,7 +185,7 @@ { double ax = std::abs (x); double lax = xlog2 (ax, exp); - return (exp == 0) ? x : (x / ax) * lax; + return (ax != lax) ? (x / ax) * lax : x; } // double -> bool mappers. @@ -503,7 +503,7 @@ { float ax = std::abs (x); float lax = xlog2 (ax, exp); - return (exp == 0) ? x : (x / ax) * lax; + return (ax != lax) ? (x / ax) * lax : x; } // float -> bool mappers.
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-06-09 Jaroslav Hajek <highegg@gmail.com> + + * data.cc (Flog2): Fix tests. + 2009-06-08 John W. Eaton <jwe@octave.org> * variables.cc (symbol_exist): Returnn 1 for function handles and
--- a/src/data.cc +++ b/src/data.cc @@ -1082,12 +1082,12 @@ %!test %! [f, e] = log2 ([0,-1; 2,-4; Inf,-Inf]); %! assert (f, [0,-0.5; 0.5,-0.5; Inf,-Inf]); -%! assert (e, [0,1;2,3;0,0]) +%! assert (e(1:2,:), [0,1;2,3]) %!test %! [f, e] = log2 (complex (zeros (3, 2), [0,-1; 2,-4; Inf,-Inf])); %! assert (f, complex (zeros (3, 2), [0,-0.5; 0.5,-0.5; Inf,-Inf])); -%! assert (e, [0,1; 2,3; 0,0]); +%! assert (e(1:2,:), [0,1; 2,3]); */ DEFUN (fmod, args, ,