Average Error: 28.5 → 0.2
Time: 4.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}^{1}}{\frac{y}{x}}\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 + \frac{{x}^{1}}{\frac{y}{x}}\right) - \frac{z}{\frac{y}{z}}\right)
double f(double x, double y, double z) {
        double r618043 = x;
        double r618044 = r618043 * r618043;
        double r618045 = y;
        double r618046 = r618045 * r618045;
        double r618047 = r618044 + r618046;
        double r618048 = z;
        double r618049 = r618048 * r618048;
        double r618050 = r618047 - r618049;
        double r618051 = 2.0;
        double r618052 = r618045 * r618051;
        double r618053 = r618050 / r618052;
        return r618053;
}

double f(double x, double y, double z) {
        double r618054 = 0.5;
        double r618055 = y;
        double r618056 = x;
        double r618057 = 1.0;
        double r618058 = pow(r618056, r618057);
        double r618059 = r618055 / r618056;
        double r618060 = r618058 / r618059;
        double r618061 = r618055 + r618060;
        double r618062 = z;
        double r618063 = r618055 / r618062;
        double r618064 = r618062 / r618063;
        double r618065 = r618061 - r618064;
        double r618066 = r618054 * r618065;
        return r618066;
}

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

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

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

    \[\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)\]
  7. 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)\]
  8. 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)\]
  9. Using strategy rm
  10. Applied unpow26.7

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

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

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

Reproduce

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