Mercurial > octave
changeset 9319:0d9178575dd7
fix log2 with 2 outargs, loosen tests to meet IEEE
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 09 Jun 2009 07:12:08 +0200 |
parents | 1a1c839625b3 |
children | 080dc45ea682 |
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 Mon Jun 08 15:12:16 2009 -0400 +++ b/liboctave/ChangeLog Tue Jun 09 07:12:08 2009 +0200 @@ -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 Mon Jun 08 15:12:16 2009 -0400 +++ b/liboctave/lo-mappers.cc Tue Jun 09 07:12:08 2009 +0200 @@ -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 Mon Jun 08 15:12:16 2009 -0400 +++ b/src/ChangeLog Tue Jun 09 07:12:08 2009 +0200 @@ -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 Mon Jun 08 15:12:16 2009 -0400 +++ b/src/data.cc Tue Jun 09 07:12:08 2009 +0200 @@ -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, ,