Average Error: 10.4 → 0.3
Time: 19.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 r527825 = x;
        double r527826 = 3.0;
        double r527827 = r527825 * r527826;
        double r527828 = r527827 * r527825;
        double r527829 = y;
        double r527830 = r527828 * r527829;
        return r527830;
}

double f(double x, double y) {
        double r527831 = x;
        double r527832 = 3.0;
        double r527833 = y;
        double r527834 = r527832 * r527833;
        double r527835 = r527834 * r527831;
        double r527836 = r527831 * r527835;
        return r527836;
}

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.4
Target0.2
Herbie0.3
\[\left(x \cdot 3\right) \cdot \left(x \cdot y\right)\]

Derivation

  1. Initial program 10.4

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

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

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

    \[\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 2019325 
(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))