Average Error: 28.2 → 0.2
Time: 26.0s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[\frac{y + \frac{z + x}{y} \cdot \left(x - z\right)}{2}\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\frac{y + \frac{z + x}{y} \cdot \left(x - z\right)}{2}
double f(double x, double y, double z) {
        double r25683564 = x;
        double r25683565 = r25683564 * r25683564;
        double r25683566 = y;
        double r25683567 = r25683566 * r25683566;
        double r25683568 = r25683565 + r25683567;
        double r25683569 = z;
        double r25683570 = r25683569 * r25683569;
        double r25683571 = r25683568 - r25683570;
        double r25683572 = 2.0;
        double r25683573 = r25683566 * r25683572;
        double r25683574 = r25683571 / r25683573;
        return r25683574;
}

double f(double x, double y, double z) {
        double r25683575 = y;
        double r25683576 = z;
        double r25683577 = x;
        double r25683578 = r25683576 + r25683577;
        double r25683579 = r25683578 / r25683575;
        double r25683580 = r25683577 - r25683576;
        double r25683581 = r25683579 * r25683580;
        double r25683582 = r25683575 + r25683581;
        double r25683583 = 2.0;
        double r25683584 = r25683582 / r25683583;
        return r25683584;
}

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

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

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

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

Reproduce

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