Average Error: 28.5 → 0.2
Time: 4.3s
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 r615937 = x;
        double r615938 = r615937 * r615937;
        double r615939 = y;
        double r615940 = r615939 * r615939;
        double r615941 = r615938 + r615940;
        double r615942 = z;
        double r615943 = r615942 * r615942;
        double r615944 = r615941 - r615943;
        double r615945 = 2.0;
        double r615946 = r615939 * r615945;
        double r615947 = r615944 / r615946;
        return r615947;
}

double f(double x, double y, double z) {
        double r615948 = 0.5;
        double r615949 = y;
        double r615950 = 1.0;
        double r615951 = x;
        double r615952 = r615949 / r615951;
        double r615953 = r615952 / r615951;
        double r615954 = r615950 / r615953;
        double r615955 = r615949 + r615954;
        double r615956 = z;
        double r615957 = fabs(r615956);
        double r615958 = r615957 / r615949;
        double r615959 = r615957 * r615958;
        double r615960 = r615955 - r615959;
        double r615961 = r615948 * r615960;
        return r615961;
}

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

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

    \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x, x, y \cdot y - z \cdot z\right)}{2}}{y}}\]
  3. Taylor expanded around 0 12.8

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

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

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(\left(y + \color{blue}{\frac{x}{\frac{y}{x}}}\right) - \left|z\right| \cdot \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}}}\right) - \left|z\right| \cdot \frac{\left|z\right|}{y}\right)\]
  16. 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 2020033 +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)))