- vector<string> a;
- ssize i = str.find (c);
- while (i != NPOS)
- {
- string s = str.substr (0, i);
- a.push_back (s);
- while (str[++i] == c)
- ;
- str = str.substr (i);
- i = str.find (c);
- }
- if (str.length ())
- a.push_back (str);
- return a;
+ if (d < 0)
+ return floor (f);
+ else
+ return ceil (f);
+}
+
+/*
+ 0 at threshold, 1 at 0, with 1/x falloff.
+ */
+Real
+peak_around (Real epsilon, Real threshold, Real x)
+{
+ if (x < 0)
+ return 1.0;
+ return max (- epsilon * (x - threshold) / ((x + epsilon) * threshold), 0.0);