diff --git a/src/@dseries/log.m b/src/@dseries/log.m index be39cf70b69c8d53fa1a826221bddc80633dbe8c..73545942c03f8e336665edba87448ea72bd02fd2 100644 --- a/src/@dseries/log.m +++ b/src/@dseries/log.m @@ -25,10 +25,6 @@ function o = log(o) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -if any(o.data<eps) - error('dseries:WrongInputArguments', 'Variables in %s have be strictly positive!', inputname(1)) -end - o = copy(o); o.log_; diff --git a/src/@dseries/log_.m b/src/@dseries/log_.m index d92323b8c4b6b748c6709e1c714d1387d5f79f8f..0d78b48978d1d14174826de43393410e5df4dd63 100644 --- a/src/@dseries/log_.m +++ b/src/@dseries/log_.m @@ -25,9 +25,8 @@ function o = log_(o) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -if any(o.data<eps) - error('dseries:WrongInputArguments', 'Variables in %s have be strictly positive!', inputname(1)) -end +% Ensure that we never return a complex number (rather return a NaN) +o.data(find(o.data < 0)) = NaN; o.data = log(o.data);