Average Error: 28.5 → 0.1
Time: 5.2s
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}^{1}}{\frac{y}{x}}\right) - z \cdot \frac{z}{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}^{1}}{\frac{y}{x}}\right) - z \cdot \frac{z}{y}\right)
double f(double x, double y, double z) {
        double r647816 = x;
        double r647817 = r647816 * r647816;
        double r647818 = y;
        double r647819 = r647818 * r647818;
        double r647820 = r647817 + r647819;
        double r647821 = z;
        double r647822 = r647821 * r647821;
        double r647823 = r647820 - r647822;
        double r647824 = 2.0;
        double r647825 = r647818 * r647824;
        double r647826 = r647823 / r647825;
        return r647826;
}

double f(double x, double y, double z) {
        double r647827 = 0.5;
        double r647828 = y;
        double r647829 = x;
        double r647830 = 1.0;
        double r647831 = pow(r647829, r647830);
        double r647832 = r647828 / r647829;
        double r647833 = r647831 / r647832;
        double r647834 = r647828 + r647833;
        double r647835 = z;
        double r647836 = r647835 / r647828;
        double r647837 = r647835 * r647836;
        double r647838 = r647834 - r647837;
        double r647839 = r647827 * r647838;
        return r647839;
}

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 sqr-pow12.7

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{{x}^{1}}{\frac{y}{x}}\right) - z \cdot \frac{z}{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)))