Average Error: 28.4 → 0.2
Time: 5.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{1}{\frac{\frac{y}{x}}{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{1}{\frac{\frac{y}{x}}{x}}\right) - \left|z\right| \cdot \frac{\left|z\right|}{y}\right)
double f(double x, double y, double z) {
        double r650597 = x;
        double r650598 = r650597 * r650597;
        double r650599 = y;
        double r650600 = r650599 * r650599;
        double r650601 = r650598 + r650600;
        double r650602 = z;
        double r650603 = r650602 * r650602;
        double r650604 = r650601 - r650603;
        double r650605 = 2.0;
        double r650606 = r650599 * r650605;
        double r650607 = r650604 / r650606;
        return r650607;
}

double f(double x, double y, double z) {
        double r650608 = 0.5;
        double r650609 = y;
        double r650610 = 1.0;
        double r650611 = x;
        double r650612 = r650609 / r650611;
        double r650613 = r650612 / r650611;
        double r650614 = r650610 / r650613;
        double r650615 = r650609 + r650614;
        double r650616 = z;
        double r650617 = fabs(r650616);
        double r650618 = r650617 / r650609;
        double r650619 = r650617 * r650618;
        double r650620 = r650615 - r650619;
        double r650621 = r650608 * r650620;
        return r650621;
}

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

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

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

    \[\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 sqr-pow12.5

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

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{{x}^{\left(\frac{2}{2}\right)}}{\frac{y}{x}}\right) - \left|z\right| \cdot \color{blue}{\frac{\left|z\right|}{y}}\right)\]
  14. Using strategy rm
  15. Applied clear-num0.2

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

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

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

Reproduce

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