Average Error: 0.0 → 0.1
Time: 5.5s
Precision: 64
\[2 \cdot \left(x \cdot x + x \cdot y\right)\]
\[x \cdot \left(\left(x + y\right) \cdot 2\right)\]
2 \cdot \left(x \cdot x + x \cdot y\right)
x \cdot \left(\left(x + y\right) \cdot 2\right)
double f(double x, double y) {
        double r521091 = 2.0;
        double r521092 = x;
        double r521093 = r521092 * r521092;
        double r521094 = y;
        double r521095 = r521092 * r521094;
        double r521096 = r521093 + r521095;
        double r521097 = r521091 * r521096;
        return r521097;
}

double f(double x, double y) {
        double r521098 = x;
        double r521099 = y;
        double r521100 = r521098 + r521099;
        double r521101 = 2.0;
        double r521102 = r521100 * r521101;
        double r521103 = r521098 * r521102;
        return r521103;
}

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

Derivation

  1. Initial program 0.0

    \[2 \cdot \left(x \cdot x + x \cdot y\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\left(x \cdot \left(x + y\right)\right) \cdot 2}\]
  3. Using strategy rm
  4. Applied associate-*l*0.1

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

    \[\leadsto x \cdot \left(\left(x + y\right) \cdot 2\right)\]

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y)
  :name "Linear.Matrix:fromQuaternion from linear-1.19.1.3, B"
  :precision binary64

  :herbie-target
  (* (* x 2) (+ x y))

  (* 2 (+ (* x x) (* x y))))