Average Error: 13.4 → 0.2
Time: 11.5s
Precision: 64
$w \cdot \left(\left(m - v\right) \cdot \left(m - v\right)\right)$
$\left(\left(m - v\right) \cdot w\right) \cdot \left(m - v\right)$
w \cdot \left(\left(m - v\right) \cdot \left(m - v\right)\right)
\left(\left(m - v\right) \cdot w\right) \cdot \left(m - v\right)
double f(double w, double m, double v) {
double r2640264 = w;
double r2640265 = m;
double r2640266 = v;
double r2640267 = r2640265 - r2640266;
double r2640268 = r2640267 * r2640267;
double r2640269 = r2640264 * r2640268;
return r2640269;
}


double f(double w, double m, double v) {
double r2640270 = m;
double r2640271 = v;
double r2640272 = r2640270 - r2640271;
double r2640273 = w;
double r2640274 = r2640272 * r2640273;
double r2640275 = r2640274 * r2640272;
return r2640275;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 13.4

$w \cdot \left(\left(m - v\right) \cdot \left(m - v\right)\right)$
2. Using strategy rm
3. Applied associate-*r*0.2

$\leadsto \color{blue}{\left(w \cdot \left(m - v\right)\right) \cdot \left(m - v\right)}$
4. Simplified0.2

$\leadsto \color{blue}{\left(\left(m - v\right) \cdot w\right)} \cdot \left(m - v\right)$
5. Final simplification0.2

$\leadsto \left(\left(m - v\right) \cdot w\right) \cdot \left(m - v\right)$

# Reproduce

herbie shell --seed 1
(FPCore (w m v)
:name "w * ((m -v) * (m-v))"
:precision binary64
(* w (* (- m v) (- m v))))