Average Error: 28.3 → 0.1
Time: 19.6s
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 r18242674 = x;
        double r18242675 = r18242674 * r18242674;
        double r18242676 = y;
        double r18242677 = r18242676 * r18242676;
        double r18242678 = r18242675 + r18242677;
        double r18242679 = z;
        double r18242680 = r18242679 * r18242679;
        double r18242681 = r18242678 - r18242680;
        double r18242682 = 2.0;
        double r18242683 = r18242676 * r18242682;
        double r18242684 = r18242681 / r18242683;
        return r18242684;
}

double f(double x, double y, double z) {
        double r18242685 = y;
        double r18242686 = z;
        double r18242687 = x;
        double r18242688 = r18242686 + r18242687;
        double r18242689 = r18242688 / r18242685;
        double r18242690 = r18242687 - r18242686;
        double r18242691 = r18242689 * r18242690;
        double r18242692 = r18242685 + r18242691;
        double r18242693 = 2.0;
        double r18242694 = r18242692 / r18242693;
        return r18242694;
}

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.3
Target0.2
Herbie0.1
\[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.3

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

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

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

Reproduce

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