Average Error: 28.8 → 0.1
Time: 3.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 \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 \cdot \frac{x}{y}\right) - z \cdot \frac{z}{y}\right)
double f(double x, double y, double z) {
        double r678410 = x;
        double r678411 = r678410 * r678410;
        double r678412 = y;
        double r678413 = r678412 * r678412;
        double r678414 = r678411 + r678413;
        double r678415 = z;
        double r678416 = r678415 * r678415;
        double r678417 = r678414 - r678416;
        double r678418 = 2.0;
        double r678419 = r678412 * r678418;
        double r678420 = r678417 / r678419;
        return r678420;
}

double f(double x, double y, double z) {
        double r678421 = 0.5;
        double r678422 = y;
        double r678423 = x;
        double r678424 = r678423 / r678422;
        double r678425 = r678423 * r678424;
        double r678426 = r678422 + r678425;
        double r678427 = z;
        double r678428 = r678427 / r678422;
        double r678429 = r678427 * r678428;
        double r678430 = r678426 - r678429;
        double r678431 = r678421 * r678430;
        return r678431;
}

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.8
Target0.1
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.8

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{x}{\frac{y}{x}}\right) - z \cdot \color{blue}{\frac{z}{y}}\right)\]
  14. Using strategy rm
  15. Applied add-sqr-sqrt32.3

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{x}{\frac{y}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}\right) - z \cdot \frac{z}{y}\right)\]
  16. Applied *-un-lft-identity32.3

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

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{x}{\color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{y}{\sqrt{x}}}}\right) - z \cdot \frac{z}{y}\right)\]
  18. Applied add-sqr-sqrt32.4

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{\frac{1}{\sqrt{x}} \cdot \frac{y}{\sqrt{x}}}\right) - z \cdot \frac{z}{y}\right)\]
  19. Applied times-frac32.4

    \[\leadsto 0.5 \cdot \left(\left(y + \color{blue}{\frac{\sqrt{x}}{\frac{1}{\sqrt{x}}} \cdot \frac{\sqrt{x}}{\frac{y}{\sqrt{x}}}}\right) - z \cdot \frac{z}{y}\right)\]
  20. Simplified32.3

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

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

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

Reproduce

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