Skip to content
Snippets Groups Projects
Verified Commit 48e34132 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

getPowerDeriv: for the derivative of x^0 in 0, return 0 instead of NaN

Ref. #73 and dynare!2358
parent aab75291
No related branches found
No related tags found
No related merge requests found
/*
* Copyright © 2003-2024 Dynare Team
* Copyright © 2003-2025 Dynare Team
*
* This file is part of Dynare.
*
......@@ -912,7 +912,7 @@ DataTree::writeCHelpersDefinition(ostream& output) const
<< "getPowerDeriv(double x, double p, int k)" << endl
<< "{" << endl
<< " if (fabs(x) < " << power_deriv_near_zero
<< " && p > 0 && k > p && fabs(p-nearbyint(p)) < " << power_deriv_near_zero << ')'
<< " && p >= 0 && k > p && fabs(p-nearbyint(p)) < " << power_deriv_near_zero << ')'
<< endl
<< " return 0.0;" << endl
<< " else" << endl
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment