Average Error: 28.5 → 0.2
Time: 17.5s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[\frac{y + \frac{x - z}{y \cdot \frac{1}{x + z}}}{2}\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\frac{y + \frac{x - z}{y \cdot \frac{1}{x + z}}}{2}
double f(double x, double y, double z) {
        double r33419652 = x;
        double r33419653 = r33419652 * r33419652;
        double r33419654 = y;
        double r33419655 = r33419654 * r33419654;
        double r33419656 = r33419653 + r33419655;
        double r33419657 = z;
        double r33419658 = r33419657 * r33419657;
        double r33419659 = r33419656 - r33419658;
        double r33419660 = 2.0;
        double r33419661 = r33419654 * r33419660;
        double r33419662 = r33419659 / r33419661;
        return r33419662;
}

double f(double x, double y, double z) {
        double r33419663 = y;
        double r33419664 = x;
        double r33419665 = z;
        double r33419666 = r33419664 - r33419665;
        double r33419667 = 1.0;
        double r33419668 = r33419664 + r33419665;
        double r33419669 = r33419667 / r33419668;
        double r33419670 = r33419663 * r33419669;
        double r33419671 = r33419666 / r33419670;
        double r33419672 = r33419663 + r33419671;
        double r33419673 = 2.0;
        double r33419674 = r33419672 / r33419673;
        return r33419674;
}

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

Original28.5
Target0.2
Herbie0.2
\[y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)\]

Derivation

  1. Initial program 28.5

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
  2. Simplified0.2

    \[\leadsto \color{blue}{\frac{y + \frac{x - z}{\frac{y}{z + x}}}{2}}\]
  3. Using strategy rm
  4. Applied div-inv0.2

    \[\leadsto \frac{y + \frac{x - z}{\color{blue}{y \cdot \frac{1}{z + x}}}}{2}\]
  5. Final simplification0.2

    \[\leadsto \frac{y + \frac{x - z}{y \cdot \frac{1}{x + z}}}{2}\]

Reproduce

herbie shell --seed 2019172 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"

  :herbie-target
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

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