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 + x \cdot \frac{x}{y}\right) - {z}^{1} \cdot \frac{{z}^{1}}{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}^{1} \cdot \frac{{z}^{1}}{y}\right)
double f(double x, double y, double z) {
        double r705550 = x;
        double r705551 = r705550 * r705550;
        double r705552 = y;
        double r705553 = r705552 * r705552;
        double r705554 = r705551 + r705553;
        double r705555 = z;
        double r705556 = r705555 * r705555;
        double r705557 = r705554 - r705556;
        double r705558 = 2.0;
        double r705559 = r705552 * r705558;
        double r705560 = r705557 / r705559;
        return r705560;
}

double f(double x, double y, double z) {
        double r705561 = 0.5;
        double r705562 = y;
        double r705563 = x;
        double r705564 = r705563 / r705562;
        double r705565 = r705563 * r705564;
        double r705566 = r705562 + r705565;
        double r705567 = z;
        double r705568 = 1.0;
        double r705569 = pow(r705567, r705568);
        double r705570 = r705569 / r705562;
        double r705571 = r705569 * r705570;
        double r705572 = r705566 - r705571;
        double r705573 = r705561 * r705572;
        return r705573;
}

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \color{blue}{\frac{x}{y}}\right) - \frac{{z}^{\left(\frac{2}{2}\right)}}{\frac{y}{z}}\right)\]
  16. Using strategy rm
  17. Applied div-inv0.2

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

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

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

Reproduce

herbie shell --seed 2020060 +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)))