Average Error: 28.2 → 0.1
Time: 37.3s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[\frac{y + \frac{z + x}{y} \cdot \left(x - z\right)}{2}\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\frac{y + \frac{z + x}{y} \cdot \left(x - z\right)}{2}
double f(double x, double y, double z) {
        double r488126 = x;
        double r488127 = r488126 * r488126;
        double r488128 = y;
        double r488129 = r488128 * r488128;
        double r488130 = r488127 + r488129;
        double r488131 = z;
        double r488132 = r488131 * r488131;
        double r488133 = r488130 - r488132;
        double r488134 = 2.0;
        double r488135 = r488128 * r488134;
        double r488136 = r488133 / r488135;
        return r488136;
}

double f(double x, double y, double z) {
        double r488137 = y;
        double r488138 = z;
        double r488139 = x;
        double r488140 = r488138 + r488139;
        double r488141 = r488140 / r488137;
        double r488142 = r488139 - r488138;
        double r488143 = r488141 * r488142;
        double r488144 = r488137 + r488143;
        double r488145 = 2.0;
        double r488146 = r488144 / r488145;
        return r488146;
}

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

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

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

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

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(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)))