Average Error: 10.3 → 0.3
Time: 8.4s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(3 \cdot y\right) \cdot x\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(3 \cdot y\right) \cdot x\right)
double f(double x, double y) {
        double r577657 = x;
        double r577658 = 3.0;
        double r577659 = r577657 * r577658;
        double r577660 = r577659 * r577657;
        double r577661 = y;
        double r577662 = r577660 * r577661;
        return r577662;
}

double f(double x, double y) {
        double r577663 = x;
        double r577664 = 3.0;
        double r577665 = y;
        double r577666 = r577664 * r577665;
        double r577667 = r577666 * r577663;
        double r577668 = r577663 * r577667;
        return r577668;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.3
Target0.3
Herbie0.3
\[\left(x \cdot 3\right) \cdot \left(x \cdot y\right)\]

Derivation

  1. Initial program 10.3

    \[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
  2. Using strategy rm
  3. Applied associate-*l*0.3

    \[\leadsto \color{blue}{\left(x \cdot 3\right) \cdot \left(x \cdot y\right)}\]
  4. Simplified0.3

    \[\leadsto \left(x \cdot 3\right) \cdot \color{blue}{\left(y \cdot x\right)}\]
  5. Using strategy rm
  6. Applied associate-*l*0.3

    \[\leadsto \color{blue}{x \cdot \left(3 \cdot \left(y \cdot x\right)\right)}\]
  7. Using strategy rm
  8. Applied associate-*r*0.3

    \[\leadsto x \cdot \color{blue}{\left(\left(3 \cdot y\right) \cdot x\right)}\]
  9. Final simplification0.3

    \[\leadsto x \cdot \left(\left(3 \cdot y\right) \cdot x\right)\]

Reproduce

herbie shell --seed 2019199 
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"

  :herbie-target
  (* (* x 3.0) (* x y))

  (* (* (* x 3.0) x) y))