Average Error: 28.6 → 12.3
Time: 5.1s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[\frac{0.5}{y} \cdot \left(x \cdot x - z \cdot z\right) + 0.5 \cdot y\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\frac{0.5}{y} \cdot \left(x \cdot x - z \cdot z\right) + 0.5 \cdot y
double f(double x, double y, double z) {
        double r453085 = x;
        double r453086 = r453085 * r453085;
        double r453087 = y;
        double r453088 = r453087 * r453087;
        double r453089 = r453086 + r453088;
        double r453090 = z;
        double r453091 = r453090 * r453090;
        double r453092 = r453089 - r453091;
        double r453093 = 2.0;
        double r453094 = r453087 * r453093;
        double r453095 = r453092 / r453094;
        return r453095;
}

double f(double x, double y, double z) {
        double r453096 = 0.5;
        double r453097 = y;
        double r453098 = r453096 / r453097;
        double r453099 = x;
        double r453100 = r453099 * r453099;
        double r453101 = z;
        double r453102 = r453101 * r453101;
        double r453103 = r453100 - r453102;
        double r453104 = r453098 * r453103;
        double r453105 = r453096 * r453097;
        double r453106 = r453104 + r453105;
        return r453106;
}

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.6
Target0.2
Herbie12.3
\[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.6

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

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

    \[\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 sqr-pow12.3

    \[\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)\]
  6. Applied associate-/l*6.9

    \[\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)\]
  7. Simplified6.9

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

    \[\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)\]
  10. Applied associate-/l*0.1

    \[\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)\]
  11. Final simplification12.3

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

Reproduce

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