Average Error: 10.2 → 0.3
Time: 4.2s
Precision: 64
\[\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y\]
\[\left(\left(y \cdot 3.0\right) \cdot x\right) \cdot x\]
\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y
\left(\left(y \cdot 3.0\right) \cdot x\right) \cdot x
double f(double x, double y) {
        double r15574145 = x;
        double r15574146 = 3.0;
        double r15574147 = r15574145 * r15574146;
        double r15574148 = r15574147 * r15574145;
        double r15574149 = y;
        double r15574150 = r15574148 * r15574149;
        return r15574150;
}

double f(double x, double y) {
        double r15574151 = y;
        double r15574152 = 3.0;
        double r15574153 = r15574151 * r15574152;
        double r15574154 = x;
        double r15574155 = r15574153 * r15574154;
        double r15574156 = r15574155 * r15574154;
        return r15574156;
}

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

Derivation

  1. Initial program 10.2

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

    \[\leadsto \color{blue}{\left(x \cdot 3.0\right) \cdot \left(x \cdot y\right)}\]
  4. Taylor expanded around 0 10.2

    \[\leadsto \color{blue}{3.0 \cdot \left({x}^{2} \cdot y\right)}\]
  5. Simplified0.2

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

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

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

Reproduce

herbie shell --seed 2019156 
(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))