void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
{
if (weight == 0) return;
- if (mean == 0) e.(a) *= pow(value, weight);
- else e.(a) += pow(value, mean) * weight;
+ if (mean == 0) e.(a) *= (value ** weight);
+ else e.(a) += (value ** mean) * weight;
e.(c) += weight;
}
float mean_evaluate(entity e, .float a, .float c, float mean)
{
if (e.(c) == 0) return 0;
- if (mean == 0) return pow(e.(a), 1.0 / e.(c));
- else return pow(e.(a) / e.(c), 1.0 / mean);
+ if (mean == 0) return (e.(a) ** (1.0 / e.(c)));
+ else return ((e.(a) / e.(c)) ** (1.0 / mean));
}
#define MEAN_ACCUMULATE(s, prefix, v, w) mean_accumulate(s, prefix##_accumulator, prefix##_count, prefix##_mean, v, w)
float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float d)
{
- if (halflifedist > 0) return pow(0.5, (bound(mindist, d, maxdist) - mindist) / halflifedist);
- else if (halflifedist < 0) return pow(0.5, (bound(mindist, d, maxdist) - maxdist) / halflifedist);
+ if (halflifedist > 0) return (0.5 ** (bound(mindist, d, maxdist) - mindist) / halflifedist);
+ else if (halflifedist < 0) return (0.5 ** (bound(mindist, d, maxdist) - maxdist) / halflifedist);
else return 1;
}
float power2of(float e)
{
- return pow(2, e);
+ return (2 ** e);
}
float log2of(float e)