Skip to content

Commit

Permalink
Don't call log10 with values too close to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Sep 2, 2024
1 parent 1421f7f commit 71d341c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/alnumeric.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ inline float level_mb_to_gain(float x)
// Converts gain to level (mB).
inline float gain_to_level_mb(float x)
{
if (x <= 0.0f)
if(x <= 1e-05f)
return -10'000.0f;
return std::max(std::log10(x) * 2'000.0f, -10'000.0f);
}
Expand Down

0 comments on commit 71d341c

Please sign in to comment.