Average Error: 27.8 → 0.1
Time: 14.6s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[0.5 \cdot \left(\left(y + {x}^{1} \cdot \frac{x}{y}\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 + {x}^{1} \cdot \frac{x}{y}\right) - z \cdot \frac{z}{y}\right)
double f(double x, double y, double z) {
        double r397190 = x;
        double r397191 = r397190 * r397190;
        double r397192 = y;
        double r397193 = r397192 * r397192;
        double r397194 = r397191 + r397193;
        double r397195 = z;
        double r397196 = r397195 * r397195;
        double r397197 = r397194 - r397196;
        double r397198 = 2.0;
        double r397199 = r397192 * r397198;
        double r397200 = r397197 / r397199;
        return r397200;
}

double f(double x, double y, double z) {
        double r397201 = 0.5;
        double r397202 = y;
        double r397203 = x;
        double r397204 = 1.0;
        double r397205 = pow(r397203, r397204);
        double r397206 = r397203 / r397202;
        double r397207 = r397205 * r397206;
        double r397208 = r397202 + r397207;
        double r397209 = z;
        double r397210 = r397209 / r397202;
        double r397211 = r397209 * r397210;
        double r397212 = r397208 - r397211;
        double r397213 = r397201 * r397212;
        return r397213;
}

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

Original27.8
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 27.8

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

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

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

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

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

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

    \[\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-sqrt35.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-down35.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-frac32.4

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

    \[\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. Using strategy rm
  16. Applied div-inv0.2

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

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

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

Reproduce

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