Average Error: 18.0 → 0.0
Time: 17.8s
Precision: 64
\[\left(\left(x \cdot y - y \cdot z\right) - y \cdot y\right) + y \cdot y\]
\[y \cdot \left(-z\right) + x \cdot y\]
\left(\left(x \cdot y - y \cdot z\right) - y \cdot y\right) + y \cdot y
y \cdot \left(-z\right) + x \cdot y
double f(double x, double y, double z) {
        double r28104615 = x;
        double r28104616 = y;
        double r28104617 = r28104615 * r28104616;
        double r28104618 = z;
        double r28104619 = r28104616 * r28104618;
        double r28104620 = r28104617 - r28104619;
        double r28104621 = r28104616 * r28104616;
        double r28104622 = r28104620 - r28104621;
        double r28104623 = r28104622 + r28104621;
        return r28104623;
}

double f(double x, double y, double z) {
        double r28104624 = y;
        double r28104625 = z;
        double r28104626 = -r28104625;
        double r28104627 = r28104624 * r28104626;
        double r28104628 = x;
        double r28104629 = r28104628 * r28104624;
        double r28104630 = r28104627 + r28104629;
        return r28104630;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original18.0
Target0.0
Herbie0.0
\[\left(x - z\right) \cdot y\]

Derivation

  1. Initial program 18.0

    \[\left(\left(x \cdot y - y \cdot z\right) - y \cdot y\right) + y \cdot y\]
  2. Using strategy rm
  3. Applied sub-neg18.0

    \[\leadsto \left(\color{blue}{\left(x \cdot y + \left(-y \cdot z\right)\right)} - y \cdot y\right) + y \cdot y\]
  4. Applied associate--l+18.0

    \[\leadsto \color{blue}{\left(x \cdot y + \left(\left(-y \cdot z\right) - y \cdot y\right)\right)} + y \cdot y\]
  5. Applied associate-+l+13.2

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

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

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

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (x y z)
  :name "Linear.Quaternion:$c/ from linear-1.19.1.3, B"

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

  (+ (- (- (* x y) (* y z)) (* y y)) (* y y)))