Average Error: 28.5 → 0.1
Time: 4.6s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[0.5 \cdot \left(\left(y + \frac{x}{y} \cdot x\right) - \left|z\right| \cdot \frac{\left|z\right|}{y}\right)\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
0.5 \cdot \left(\left(y + \frac{x}{y} \cdot x\right) - \left|z\right| \cdot \frac{\left|z\right|}{y}\right)
double f(double x, double y, double z) {
        double r606613 = x;
        double r606614 = r606613 * r606613;
        double r606615 = y;
        double r606616 = r606615 * r606615;
        double r606617 = r606614 + r606616;
        double r606618 = z;
        double r606619 = r606618 * r606618;
        double r606620 = r606617 - r606619;
        double r606621 = 2.0;
        double r606622 = r606615 * r606621;
        double r606623 = r606620 / r606622;
        return r606623;
}

double f(double x, double y, double z) {
        double r606624 = 0.5;
        double r606625 = y;
        double r606626 = x;
        double r606627 = r606626 / r606625;
        double r606628 = r606627 * r606626;
        double r606629 = r606625 + r606628;
        double r606630 = z;
        double r606631 = fabs(r606630);
        double r606632 = r606631 / r606625;
        double r606633 = r606631 * r606632;
        double r606634 = r606629 - r606633;
        double r606635 = r606624 * r606634;
        return r606635;
}

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

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

    \[\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.7

    \[\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 unpow212.7

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{x}{\frac{y}{x}}\right) - \left|z\right| \cdot \color{blue}{\frac{\left|z\right|}{y}}\right)\]
  13. Using strategy rm
  14. Applied associate-/r/0.1

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

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

Reproduce

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