Skip to content

Commit

Permalink
handle potential -nan generation
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 9, 2020
1 parent 5a79826 commit f330e6f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Etterna/Globals/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,10 +1740,16 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,
0.25f +
0.4f * (static_cast<float>(totaltaps) / static_cast<float>(cvtaps)) +
dswip * 0.25f;
Cv = sqrt(Cv) - 0.1f;
Cv += barf;
Cv *= barf2;
doot[Roll][i] = CalcClamp(Cv, 0.5f, 1.f);

// some weird anchor problems can cause sqrt(-f) here so...
if (Cv > 0.01f) {
Cv = fastsqrt(Cv) - 0.1f;
Cv += barf;
Cv *= barf2;
doot[Roll][i] = CalcClamp(Cv, 0.5f, 1.f);
}

else doot[Roll][i] = 1.f;

doot[OHTrill][i] = CalcClamp(0.5f + fastsqrt(yes_trills), 0.8f, 1.f);
// if (debugmode)
Expand Down

0 comments on commit f330e6f

Please sign in to comment.