Average Error: 28.5 → 0.1
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 + \frac{x}{\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}{\frac{y}{x}}\right) - z \cdot \frac{z}{y}\right)
double f(double x, double y, double z) {
        double r619746 = x;
        double r619747 = r619746 * r619746;
        double r619748 = y;
        double r619749 = r619748 * r619748;
        double r619750 = r619747 + r619749;
        double r619751 = z;
        double r619752 = r619751 * r619751;
        double r619753 = r619750 - r619752;
        double r619754 = 2.0;
        double r619755 = r619748 * r619754;
        double r619756 = r619753 / r619755;
        return r619756;
}

double f(double x, double y, double z) {
        double r619757 = 0.5;
        double r619758 = y;
        double r619759 = x;
        double r619760 = r619758 / r619759;
        double r619761 = r619759 / r619760;
        double r619762 = r619758 + r619761;
        double r619763 = z;
        double r619764 = r619763 / r619758;
        double r619765 = r619763 * r619764;
        double r619766 = r619762 - r619765;
        double r619767 = r619757 * r619766;
        return r619767;
}

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 unpow212.7

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

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

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

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

    \[\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. Final simplification0.1

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

Reproduce

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