Average Error: 7.3 → 7.4
Time: 14.8s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\frac{1}{\frac{1 - \frac{y}{z}}{y + x}}\]
\frac{x + y}{1 - \frac{y}{z}}
\frac{1}{\frac{1 - \frac{y}{z}}{y + x}}
double f(double x, double y, double z) {
        double r28040230 = x;
        double r28040231 = y;
        double r28040232 = r28040230 + r28040231;
        double r28040233 = 1.0;
        double r28040234 = z;
        double r28040235 = r28040231 / r28040234;
        double r28040236 = r28040233 - r28040235;
        double r28040237 = r28040232 / r28040236;
        return r28040237;
}

double f(double x, double y, double z) {
        double r28040238 = 1.0;
        double r28040239 = 1.0;
        double r28040240 = y;
        double r28040241 = z;
        double r28040242 = r28040240 / r28040241;
        double r28040243 = r28040239 - r28040242;
        double r28040244 = x;
        double r28040245 = r28040240 + r28040244;
        double r28040246 = r28040243 / r28040245;
        double r28040247 = r28040238 / r28040246;
        return r28040247;
}

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

Original7.3
Target4.1
Herbie7.4
\[\begin{array}{l} \mathbf{if}\;y \lt -3.742931076268985646434612946949172132145 \cdot 10^{171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.553466245608673435460441960303815115662 \cdot 10^{168}:\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \end{array}\]

Derivation

  1. Initial program 7.3

    \[\frac{x + y}{1 - \frac{y}{z}}\]
  2. Using strategy rm
  3. Applied clear-num7.4

    \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}}\]
  4. Final simplification7.4

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

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"

  :herbie-target
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))

  (/ (+ x y) (- 1.0 (/ y z))))