Skip to content

Commit 7136c2c

Browse files
authored
Correctly handle underflow of very small probabilities in displaying logit output. (#796)
1 parent 01a8a87 commit 7136c2c

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- `enumpoly` would take a very long time on some supports where an equilibrium is located on the
1010
boundary of the projected game. Search is now restricted to the interior of the space ruling
1111
these out; these will always be found by another projection. (#756)
12+
- In the graphical interface, the logit correspondence display would fail and terminate the program
13+
on very small (<10^{-300}) probabilities.
1214

1315
## [16.5.1] - unreleased
1416

src/gui/dlefglogit.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,12 @@ void LogitBehavList::AddProfile(const wxString &p_text, bool p_forceShow)
171171
}
172172
m_lambdas.push_back(std::stod(next.ToStdString()));
173173
for (size_t i = 1; i <= profile->BehaviorProfileLength(); i++) {
174-
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
174+
try {
175+
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
176+
}
177+
catch (std::out_of_range &) {
178+
(*profile)[i] = 0.0;
179+
}
175180
}
176181
m_profiles.push_back(profile);
177182
if (p_forceShow || m_profiles.size() - GetNumberRows() > 20) {

src/gui/dlnfglogit.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ void LogitMixedBranch::AddProfile(const wxString &p_text)
7777
m_lambdas.push_back(std::stod(next.ToStdString()));
7878

7979
for (size_t i = 1; i <= profile->MixedProfileLength(); i++) {
80-
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
80+
try {
81+
(*profile)[i] = std::stod(tok.GetNextToken().ToStdString());
82+
}
83+
catch (std::out_of_range &) {
84+
(*profile)[i] = 0.0;
85+
}
8186
}
8287

8388
m_profiles.push_back(profile);

0 commit comments

Comments
 (0)