Average Error: 13.4 → 0.2
Time: 11.3s
Precision: 64
$w \cdot \left(\left(v - m\right) \cdot \left(v - m\right)\right)$
$\left(\left(v - m\right) \cdot w\right) \cdot \left(v - m\right)$
w \cdot \left(\left(v - m\right) \cdot \left(v - m\right)\right)
\left(\left(v - m\right) \cdot w\right) \cdot \left(v - m\right)
double f(double w, double v, double m) {
double r3451033 = w;
double r3451034 = v;
double r3451035 = m;
double r3451036 = r3451034 - r3451035;
double r3451037 = r3451036 * r3451036;
double r3451038 = r3451033 * r3451037;
return r3451038;
}


double f(double w, double v, double m) {
double r3451039 = v;
double r3451040 = m;
double r3451041 = r3451039 - r3451040;
double r3451042 = w;
double r3451043 = r3451041 * r3451042;
double r3451044 = r3451043 * r3451041;
return r3451044;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 13.4

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

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

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

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

# Reproduce

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