Average Error: 0.0 → 0.0
Time: 8.2s
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 r29948820 = 2.0;
        double r29948821 = x;
        double r29948822 = r29948821 * r29948821;
        double r29948823 = y;
        double r29948824 = r29948821 * r29948823;
        double r29948825 = r29948822 - r29948824;
        double r29948826 = r29948820 * r29948825;
        return r29948826;
}

double f(double x, double y) {
        double r29948827 = 2.0;
        double r29948828 = x;
        double r29948829 = r29948827 * r29948828;
        double r29948830 = r29948829 * r29948828;
        double r29948831 = y;
        double r29948832 = -r29948831;
        double r29948833 = r29948829 * r29948832;
        double r29948834 = r29948830 + r29948833;
        return r29948834;
}

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 2019171 
(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))))