From 2a49c251233b3ceb99e37c1012e468e55e46aa9d Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Wed, 29 Jan 2020 17:48:16 +0100
Subject: [PATCH] Gali_discretion.mod: filter out NaN in planner_objective

Related to https://git.dynare.org/Dynare/dynare/issues/1699

(cherry picked from commit 9e82432f87740b6eb3e4b53c5b805b61cda8739a)
---
 tests/discretionary_policy/Gali_discretion.mod | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/discretionary_policy/Gali_discretion.mod b/tests/discretionary_policy/Gali_discretion.mod
index 4324a0f47a..fc596311eb 100644
--- a/tests/discretionary_policy/Gali_discretion.mod
+++ b/tests/discretionary_policy/Gali_discretion.mod
@@ -130,7 +130,7 @@ end
 %Compute theoretical objective function
 V=betta/(1-betta)*(var_pi_theoretical+alpha_x*var_y_gap_theoretical); %evaluate at steady state in first period
 
-if abs(V-oo_.planner_objective_value)>1e-10
+if isnan(oo_.planner_objective_value) || abs(V-oo_.planner_objective_value)>1e-10
     error('Computed welfare deviates from theoretical welfare')
 end
 end;
@@ -144,6 +144,6 @@ end;
 V=var_pi_theoretical+alpha_x*var_y_gap_theoretical+ betta/(1-betta)*(var_pi_theoretical+alpha_x*var_y_gap_theoretical); %evaluate at steady state in first period
  
 discretionary_policy(instruments=(i),irf=20,discretionary_tol=1e-12,planner_discount=betta) y_gap pi p u;
-if abs(V-oo_.planner_objective_value)>1e-10
+if isnan(oo_.planner_objective_value) || abs(V-oo_.planner_objective_value)>1e-10
     error('Computed welfare deviates from theoretical welfare')
 end
-- 
GitLab