# HG changeset patch # User Jaroslav Hajek # Date 1244524328 -7200 # Node ID 0d9178575dd7f5fa7581aef889130a6832ccf86e # Parent 1a1c839625b33e8040369f3bbe3e38caa2f71137 fix log2 with 2 outargs, loosen tests to meet IEEE diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2009-06-09 Jaroslav Hajek + + * lo-mappers.cc (xlog2 (const Complex&, int&), xlog2 (const + FloatComplex&, int&)): Use more robust expression. + 2009-06-07 Jaroslav Hajek * Array.cc (Array::find): Avoid allocating excessive memory. Fix diff --git a/liboctave/lo-mappers.cc b/liboctave/lo-mappers.cc --- 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. diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-06-09 Jaroslav Hajek + + * data.cc (Flog2): Fix tests. + 2009-06-08 John W. Eaton * variables.cc (symbol_exist): Returnn 1 for function handles and diff --git a/src/data.cc b/src/data.cc --- 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, ,