Average Error: 7.5 → 7.5
Time: 18.7s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\frac{y + x}{1 - \frac{y}{z}}\]
\frac{x + y}{1 - \frac{y}{z}}
\frac{y + x}{1 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r31122532 = x;
        double r31122533 = y;
        double r31122534 = r31122532 + r31122533;
        double r31122535 = 1.0;
        double r31122536 = z;
        double r31122537 = r31122533 / r31122536;
        double r31122538 = r31122535 - r31122537;
        double r31122539 = r31122534 / r31122538;
        return r31122539;
}

double f(double x, double y, double z) {
        double r31122540 = y;
        double r31122541 = x;
        double r31122542 = r31122540 + r31122541;
        double r31122543 = 1.0;
        double r31122544 = z;
        double r31122545 = r31122540 / r31122544;
        double r31122546 = r31122543 - r31122545;
        double r31122547 = r31122542 / r31122546;
        return r31122547;
}

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.5
Target3.9
Herbie7.5
\[\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.5

    \[\frac{x + y}{1 - \frac{y}{z}}\]
  2. Final simplification7.5

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

Reproduce

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