\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
3 \cdot \left(\left(x \cdot y\right) \cdot x\right)
double f(double x, double y) {
double r504541 = x;
double r504542 = 3.0;
double r504543 = r504541 * r504542;
double r504544 = r504543 * r504541;
double r504545 = y;
double r504546 = r504544 * r504545;
return r504546;
}
double f(double x, double y) {
double r504547 = 3.0;
double r504548 = x;
double r504549 = y;
double r504550 = r504548 * r504549;
double r504551 = r504550 * r504548;
double r504552 = r504547 * r504551;
return r504552;
}




Bits error versus x




Bits error versus y
Results
| Original | 10.4 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
Initial program 10.4
rmApplied associate-*l*0.3
rmApplied associate-*l*0.3
rmApplied *-commutative0.3
rmApplied associate-*l*0.3
Final simplification0.3
herbie shell --seed 2019326 +o rules:numerics
(FPCore (x y)
:name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(* (* x 3) (* x y))
(* (* (* x 3) x) y))