Average Error: 0.3 → 0.2
Time: 18.9s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y\]
\[\left(x \cdot y\right) \cdot \left(3 \cdot y\right)\]
\left(\left(x \cdot 3\right) \cdot y\right) \cdot y
\left(x \cdot y\right) \cdot \left(3 \cdot y\right)
double f(double x, double y) {
        double r500346 = x;
        double r500347 = 3.0;
        double r500348 = r500346 * r500347;
        double r500349 = y;
        double r500350 = r500348 * r500349;
        double r500351 = r500350 * r500349;
        return r500351;
}

double f(double x, double y) {
        double r500352 = x;
        double r500353 = y;
        double r500354 = r500352 * r500353;
        double r500355 = 3.0;
        double r500356 = r500355 * r500353;
        double r500357 = r500354 * r500356;
        return r500357;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.3

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

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

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

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

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

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

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

    \[\leadsto y \cdot {\color{blue}{\left(3 \cdot \left(x \cdot y\right)\right)}}^{1}\]
  11. Using strategy rm
  12. Applied unpow-prod-down0.3

    \[\leadsto y \cdot \color{blue}{\left({3}^{1} \cdot {\left(x \cdot y\right)}^{1}\right)}\]
  13. Applied associate-*r*0.2

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

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

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

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, B"
  :precision binary64

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

  (* (* (* x 3) y) y))