Average Error: 0.0 → 0.0
Time: 4.9s
Precision: 64
\[2 \cdot \left(x \cdot x - x \cdot y\right)\]
\[\left(2 \cdot x\right) \cdot x + \left(2 \cdot x\right) \cdot \left(-y\right)\]
2 \cdot \left(x \cdot x - x \cdot y\right)
\left(2 \cdot x\right) \cdot x + \left(2 \cdot x\right) \cdot \left(-y\right)
double f(double x, double y) {
        double r25433046 = 2.0;
        double r25433047 = x;
        double r25433048 = r25433047 * r25433047;
        double r25433049 = y;
        double r25433050 = r25433047 * r25433049;
        double r25433051 = r25433048 - r25433050;
        double r25433052 = r25433046 * r25433051;
        return r25433052;
}

double f(double x, double y) {
        double r25433053 = 2.0;
        double r25433054 = x;
        double r25433055 = r25433053 * r25433054;
        double r25433056 = r25433055 * r25433054;
        double r25433057 = y;
        double r25433058 = -r25433057;
        double r25433059 = r25433055 * r25433058;
        double r25433060 = r25433056 + r25433059;
        return r25433060;
}

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.0
\[\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(2 \cdot x\right) \cdot \left(x - y\right)}\]
  3. Using strategy rm
  4. Applied sub-neg0.0

    \[\leadsto \left(2 \cdot x\right) \cdot \color{blue}{\left(x + \left(-y\right)\right)}\]
  5. Applied distribute-lft-in0.0

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

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

Reproduce

herbie shell --seed 2019174 
(FPCore (x y)
  :name "Linear.Matrix:fromQuaternion from linear-1.19.1.3, A"

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

  (* 2.0 (- (* x x) (* x y))))