Average Error: 10.4 → 0.3
Time: 10.5s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(\left(y \cdot 3\right) \cdot x\right) \cdot x\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(\left(y \cdot 3\right) \cdot x\right) \cdot x
double f(double x, double y) {
        double r757639 = x;
        double r757640 = 3.0;
        double r757641 = r757639 * r757640;
        double r757642 = r757641 * r757639;
        double r757643 = y;
        double r757644 = r757642 * r757643;
        return r757644;
}

double f(double x, double y) {
        double r757645 = y;
        double r757646 = 3.0;
        double r757647 = r757645 * r757646;
        double r757648 = x;
        double r757649 = r757647 * r757648;
        double r757650 = r757649 * r757648;
        return r757650;
}

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. Using strategy rm
  5. Applied associate-*l*0.2

    \[\leadsto \color{blue}{x \cdot \left(3 \cdot \left(x \cdot y\right)\right)}\]
  6. Using strategy rm
  7. Applied pow10.2

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

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020047 +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))