Average Error: 26.9 → 0.1
Time: 9.8s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2.0}\]
\[\frac{y - \left(x + z\right) \cdot \frac{z - x}{y}}{2.0}\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2.0}
\frac{y - \left(x + z\right) \cdot \frac{z - x}{y}}{2.0}
double f(double x, double y, double z) {
        double r12269531 = x;
        double r12269532 = r12269531 * r12269531;
        double r12269533 = y;
        double r12269534 = r12269533 * r12269533;
        double r12269535 = r12269532 + r12269534;
        double r12269536 = z;
        double r12269537 = r12269536 * r12269536;
        double r12269538 = r12269535 - r12269537;
        double r12269539 = 2.0;
        double r12269540 = r12269533 * r12269539;
        double r12269541 = r12269538 / r12269540;
        return r12269541;
}

double f(double x, double y, double z) {
        double r12269542 = y;
        double r12269543 = x;
        double r12269544 = z;
        double r12269545 = r12269543 + r12269544;
        double r12269546 = r12269544 - r12269543;
        double r12269547 = r12269546 / r12269542;
        double r12269548 = r12269545 * r12269547;
        double r12269549 = r12269542 - r12269548;
        double r12269550 = 2.0;
        double r12269551 = r12269549 / r12269550;
        return r12269551;
}

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

Original26.9
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 26.9

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

    \[\leadsto \color{blue}{\frac{y - \frac{z \cdot z - x \cdot x}{y}}{2.0}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity12.3

    \[\leadsto \frac{y - \frac{z \cdot z - x \cdot x}{\color{blue}{1 \cdot y}}}{2.0}\]
  5. Applied difference-of-squares12.2

    \[\leadsto \frac{y - \frac{\color{blue}{\left(z + x\right) \cdot \left(z - x\right)}}{1 \cdot y}}{2.0}\]
  6. Applied times-frac0.1

    \[\leadsto \frac{y - \color{blue}{\frac{z + x}{1} \cdot \frac{z - x}{y}}}{2.0}\]
  7. Simplified0.1

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

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

Reproduce

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