Average Error: 27.4 → 0.1
Time: 17.6s
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 r38007665 = x;
        double r38007666 = r38007665 * r38007665;
        double r38007667 = y;
        double r38007668 = r38007667 * r38007667;
        double r38007669 = r38007666 + r38007668;
        double r38007670 = z;
        double r38007671 = r38007670 * r38007670;
        double r38007672 = r38007669 - r38007671;
        double r38007673 = 2.0;
        double r38007674 = r38007667 * r38007673;
        double r38007675 = r38007672 / r38007674;
        return r38007675;
}

double f(double x, double y, double z) {
        double r38007676 = y;
        double r38007677 = x;
        double r38007678 = z;
        double r38007679 = r38007677 - r38007678;
        double r38007680 = r38007678 + r38007677;
        double r38007681 = r38007676 / r38007680;
        double r38007682 = r38007679 / r38007681;
        double r38007683 = r38007676 + r38007682;
        double r38007684 = 2.0;
        double r38007685 = r38007683 / r38007684;
        return r38007685;
}

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)))