Average Error: 28.5 → 0.2
Time: 17.3s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[\frac{y + \frac{x - z}{y \cdot \frac{1}{x + z}}}{2}\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\frac{y + \frac{x - z}{y \cdot \frac{1}{x + z}}}{2}
double f(double x, double y, double z) {
        double r27533230 = x;
        double r27533231 = r27533230 * r27533230;
        double r27533232 = y;
        double r27533233 = r27533232 * r27533232;
        double r27533234 = r27533231 + r27533233;
        double r27533235 = z;
        double r27533236 = r27533235 * r27533235;
        double r27533237 = r27533234 - r27533236;
        double r27533238 = 2.0;
        double r27533239 = r27533232 * r27533238;
        double r27533240 = r27533237 / r27533239;
        return r27533240;
}

double f(double x, double y, double z) {
        double r27533241 = y;
        double r27533242 = x;
        double r27533243 = z;
        double r27533244 = r27533242 - r27533243;
        double r27533245 = 1.0;
        double r27533246 = r27533242 + r27533243;
        double r27533247 = r27533245 / r27533246;
        double r27533248 = r27533241 * r27533247;
        double r27533249 = r27533244 / r27533248;
        double r27533250 = r27533241 + r27533249;
        double r27533251 = 2.0;
        double r27533252 = r27533250 / r27533251;
        return r27533252;
}

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. Simplified0.2

    \[\leadsto \color{blue}{\frac{y + \frac{x - z}{\frac{y}{z + x}}}{2}}\]
  3. Using strategy rm
  4. Applied div-inv0.2

    \[\leadsto \frac{y + \frac{x - z}{\color{blue}{y \cdot \frac{1}{z + x}}}}{2}\]
  5. Final simplification0.2

    \[\leadsto \frac{y + \frac{x - z}{y \cdot \frac{1}{x + z}}}{2}\]

Reproduce

herbie shell --seed 2019172 
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"

  :herbie-target
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

  (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))