Average Error: 10.3 → 0.3
Time: 6.7s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(y \cdot 3\right) \cdot x\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(y \cdot 3\right) \cdot x\right)
double f(double x, double y) {
        double r679877 = x;
        double r679878 = 3.0;
        double r679879 = r679877 * r679878;
        double r679880 = r679879 * r679877;
        double r679881 = y;
        double r679882 = r679880 * r679881;
        return r679882;
}

double f(double x, double y) {
        double r679883 = x;
        double r679884 = y;
        double r679885 = 3.0;
        double r679886 = r679884 * r679885;
        double r679887 = r679886 * r679883;
        double r679888 = r679883 * r679887;
        return r679888;
}

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.2
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. Simplified10.3

    \[\leadsto \color{blue}{\left(x \cdot \left(x \cdot 3\right)\right) \cdot y}\]
  3. Using strategy rm
  4. Applied pow110.3

    \[\leadsto \left(x \cdot \left(x \cdot 3\right)\right) \cdot \color{blue}{{y}^{1}}\]
  5. Applied pow110.3

    \[\leadsto \left(x \cdot \left(x \cdot \color{blue}{{3}^{1}}\right)\right) \cdot {y}^{1}\]
  6. Applied pow110.3

    \[\leadsto \left(x \cdot \left(\color{blue}{{x}^{1}} \cdot {3}^{1}\right)\right) \cdot {y}^{1}\]
  7. Applied pow-prod-down10.3

    \[\leadsto \left(x \cdot \color{blue}{{\left(x \cdot 3\right)}^{1}}\right) \cdot {y}^{1}\]
  8. Applied pow110.3

    \[\leadsto \left(\color{blue}{{x}^{1}} \cdot {\left(x \cdot 3\right)}^{1}\right) \cdot {y}^{1}\]
  9. Applied pow-prod-down10.3

    \[\leadsto \color{blue}{{\left(x \cdot \left(x \cdot 3\right)\right)}^{1}} \cdot {y}^{1}\]
  10. Applied pow-prod-down10.3

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

    \[\leadsto {\color{blue}{\left(\left(y \cdot x\right) \cdot \left(x \cdot 3\right)\right)}}^{1}\]
  12. Taylor expanded around 0 10.3

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

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

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

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

Reproduce

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