Average Error: 0.0 → 0.0
Time: 12.1s
Precision: 64
\[2.0 \cdot \left(x \cdot x - x \cdot y\right)\]
\[\left(2.0 \cdot x\right) \cdot x + \left(2.0 \cdot x\right) \cdot \left(-y\right)\]
2.0 \cdot \left(x \cdot x - x \cdot y\right)
\left(2.0 \cdot x\right) \cdot x + \left(2.0 \cdot x\right) \cdot \left(-y\right)
double f(double x, double y) {
        double r19577089 = 2.0;
        double r19577090 = x;
        double r19577091 = r19577090 * r19577090;
        double r19577092 = y;
        double r19577093 = r19577090 * r19577092;
        double r19577094 = r19577091 - r19577093;
        double r19577095 = r19577089 * r19577094;
        return r19577095;
}

double f(double x, double y) {
        double r19577096 = 2.0;
        double r19577097 = x;
        double r19577098 = r19577096 * r19577097;
        double r19577099 = r19577098 * r19577097;
        double r19577100 = y;
        double r19577101 = -r19577100;
        double r19577102 = r19577098 * r19577101;
        double r19577103 = r19577099 + r19577102;
        return r19577103;
}

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

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

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

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

Reproduce

herbie shell --seed 2019158 
(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))))