Commit 8e946ca3 authored by Ell's avatar Ell

app: don't calculate balance when base == 1 in spiral, to avoid NaN

parent ac51991f
......@@ -93,8 +93,11 @@ slider_line_callback (GObject *config,
base = 1.0 / sliders[0].value;
base = MIN (base, 1000000.0);
/* keep "balance" fixed when changing "base". a bit ugly :P */
if (base == old_base)
/* keep "balance" fixed when changing "base", or when "base" is 1, in
* which case there's no inverse mapping for the slider value, and we
* can get NaN.
*/
if (base == old_base && base > 1.0)
{
balance = -4.0 * log (sliders[1].value) / log (base) - 1.0;
balance = CLAMP (balance, -1.0, 1.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment