Average Error: 0.0 → 0.0
Time: 14.0s
Precision: 64
\[2.0 \cdot \left(x \cdot x - x \cdot y\right)\]
\[\left(\left(x - y\right) \cdot 2.0\right) \cdot x\]
2.0 \cdot \left(x \cdot x - x \cdot y\right)
\left(\left(x - y\right) \cdot 2.0\right) \cdot x
double f(double x, double y) {
        double r23351017 = 2.0;
        double r23351018 = x;
        double r23351019 = r23351018 * r23351018;
        double r23351020 = y;
        double r23351021 = r23351018 * r23351020;
        double r23351022 = r23351019 - r23351021;
        double r23351023 = r23351017 * r23351022;
        return r23351023;
}

double f(double x, double y) {
        double r23351024 = x;
        double r23351025 = y;
        double r23351026 = r23351024 - r23351025;
        double r23351027 = 2.0;
        double r23351028 = r23351026 * r23351027;
        double r23351029 = r23351028 * r23351024;
        return r23351029;
}

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.0\right) \cdot \left(x - y\right)\]

Derivation

  1. Initial program 0.0

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

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

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

Reproduce

herbie shell --seed 2019168 +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))))