Average Error: 0.0 → 0.1
Time: 9.6s
Precision: 64
\[2 \cdot \left(x \cdot x - x \cdot y\right)\]
\[\left(\left(x - y\right) \cdot 2\right) \cdot x\]
2 \cdot \left(x \cdot x - x \cdot y\right)
\left(\left(x - y\right) \cdot 2\right) \cdot x
double f(double x, double y) {
        double r23304189 = 2.0;
        double r23304190 = x;
        double r23304191 = r23304190 * r23304190;
        double r23304192 = y;
        double r23304193 = r23304190 * r23304192;
        double r23304194 = r23304191 - r23304193;
        double r23304195 = r23304189 * r23304194;
        return r23304195;
}

double f(double x, double y) {
        double r23304196 = x;
        double r23304197 = y;
        double r23304198 = r23304196 - r23304197;
        double r23304199 = 2.0;
        double r23304200 = r23304198 * r23304199;
        double r23304201 = r23304200 * r23304196;
        return r23304201;
}

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.1

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

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

Reproduce

herbie shell --seed 2019170 +o rules:numerics
(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))))