Average Error: 27.4 → 0.1
Time: 17.2s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2.0}\]
\[\frac{y + \frac{x - z}{\frac{y}{z + x}}}{2.0}\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2.0}
\frac{y + \frac{x - z}{\frac{y}{z + x}}}{2.0}
double f(double x, double y, double z) {
        double r33861910 = x;
        double r33861911 = r33861910 * r33861910;
        double r33861912 = y;
        double r33861913 = r33861912 * r33861912;
        double r33861914 = r33861911 + r33861913;
        double r33861915 = z;
        double r33861916 = r33861915 * r33861915;
        double r33861917 = r33861914 - r33861916;
        double r33861918 = 2.0;
        double r33861919 = r33861912 * r33861918;
        double r33861920 = r33861917 / r33861919;
        return r33861920;
}

double f(double x, double y, double z) {
        double r33861921 = y;
        double r33861922 = x;
        double r33861923 = z;
        double r33861924 = r33861922 - r33861923;
        double r33861925 = r33861923 + r33861922;
        double r33861926 = r33861921 / r33861925;
        double r33861927 = r33861924 / r33861926;
        double r33861928 = r33861921 + r33861927;
        double r33861929 = 2.0;
        double r33861930 = r33861928 / r33861929;
        return r33861930;
}

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

Original27.4
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 27.4

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2.0}\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\frac{y + \frac{x - z}{\frac{y}{z + x}}}{2.0}}\]
  3. Using strategy rm
  4. Applied +-commutative0.1

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

    \[\leadsto \frac{y + \frac{x - z}{\frac{y}{z + x}}}{2.0}\]

Reproduce

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