Average Error: 28.0 → 0.2
Time: 3.9s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[0.5 \cdot \left(\left(y + \left|x\right| \cdot \frac{\left|x\right|}{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 + \left|x\right| \cdot \frac{\left|x\right|}{y}\right) - \frac{z}{\frac{y}{z}}\right)
double f(double x, double y, double z) {
        double r925872 = x;
        double r925873 = r925872 * r925872;
        double r925874 = y;
        double r925875 = r925874 * r925874;
        double r925876 = r925873 + r925875;
        double r925877 = z;
        double r925878 = r925877 * r925877;
        double r925879 = r925876 - r925878;
        double r925880 = 2.0;
        double r925881 = r925874 * r925880;
        double r925882 = r925879 / r925881;
        return r925882;
}

double f(double x, double y, double z) {
        double r925883 = 0.5;
        double r925884 = y;
        double r925885 = x;
        double r925886 = fabs(r925885);
        double r925887 = r925886 / r925884;
        double r925888 = r925886 * r925887;
        double r925889 = r925884 + r925888;
        double r925890 = z;
        double r925891 = r925884 / r925890;
        double r925892 = r925890 / r925891;
        double r925893 = r925889 - r925892;
        double r925894 = r925883 * r925893;
        return r925894;
}

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-sqrt12.2

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020035 
(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)))