From e844895b55482e64294ba826de0f0ef9a1cd3cbc Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtanb@gmail.com>
Date: Wed, 9 Jun 2010 15:09:55 +0200
Subject: [PATCH] Bug fix: catch the case when a parameter follows a beta
 distribution with mean = std err = 0.5(cherry picked from commit
 28d30d9a626a8d7be0866038924bfc52a935ee27)

---
 preprocessor/ComputingTasks.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index 2047fc38c6..f3a8eeab64 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -318,6 +318,15 @@ EstimatedParamsStatement::EstimatedParamsStatement(const vector<EstimationParams
   estim_params_list(estim_params_list_arg),
   symbol_table(symbol_table_arg)
 {
+  for (vector<EstimationParams>::const_iterator it = estim_params_list.begin();
+       it != estim_params_list.end(); it++)
+    if (it->prior == "1") //BETA_PDF is associated with "1" in DynareBison.yy
+      if (dynamic_cast<NumConstNode *>(it->mean)->isNumConstNodeEqualTo(0.5) &&
+          dynamic_cast<NumConstNode *>(it->std)->isNumConstNodeEqualTo(0.5))
+        {
+          cerr << "The prior density is not defined for the beta distribution when the mean = standard deviation = 0.5." << endl;
+          exit(EXIT_FAILURE);
+        }
 }
 
 void
-- 
GitLab