Average Error: 28.0 → 0.2
Time: 5.1s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \frac{z}{\frac{y}{z}}\right)\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \frac{z}{\frac{y}{z}}\right)
double f(double x, double y, double z) {
        double r582608 = x;
        double r582609 = r582608 * r582608;
        double r582610 = y;
        double r582611 = r582610 * r582610;
        double r582612 = r582609 + r582611;
        double r582613 = z;
        double r582614 = r582613 * r582613;
        double r582615 = r582612 - r582614;
        double r582616 = 2.0;
        double r582617 = r582610 * r582616;
        double r582618 = r582615 / r582617;
        return r582618;
}

double f(double x, double y, double z) {
        double r582619 = 0.5;
        double r582620 = y;
        double r582621 = x;
        double r582622 = r582621 / r582620;
        double r582623 = r582621 * r582622;
        double r582624 = r582620 + r582623;
        double r582625 = z;
        double r582626 = r582620 / r582625;
        double r582627 = r582625 / r582626;
        double r582628 = r582624 - r582627;
        double r582629 = r582619 * r582628;
        return r582629;
}

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

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
  2. Taylor expanded around 0 12.2

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

    \[\leadsto \color{blue}{0.5 \cdot \left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity12.2

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{{x}^{2}}{\color{blue}{1 \cdot y}}\right) - \frac{{z}^{2}}{y}\right)\]
  6. Applied add-sqr-sqrt37.7

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2}}{1 \cdot y}\right) - \frac{{z}^{2}}{y}\right)\]
  7. Applied unpow-prod-down37.7

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{\color{blue}{{\left(\sqrt{x}\right)}^{2} \cdot {\left(\sqrt{x}\right)}^{2}}}{1 \cdot y}\right) - \frac{{z}^{2}}{y}\right)\]
  8. Applied times-frac34.9

    \[\leadsto 0.5 \cdot \left(\left(y + \color{blue}{\frac{{\left(\sqrt{x}\right)}^{2}}{1} \cdot \frac{{\left(\sqrt{x}\right)}^{2}}{y}}\right) - \frac{{z}^{2}}{y}\right)\]
  9. Simplified34.9

    \[\leadsto 0.5 \cdot \left(\left(y + \color{blue}{x} \cdot \frac{{\left(\sqrt{x}\right)}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)\]
  10. Simplified6.7

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \color{blue}{\frac{x}{y}}\right) - \frac{{z}^{2}}{y}\right)\]
  11. Using strategy rm
  12. Applied unpow26.7

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \frac{\color{blue}{z \cdot z}}{y}\right)\]
  13. Applied associate-/l*0.2

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

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

Reproduce

herbie shell --seed 2020035 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

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

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