Average Error: 7.3 → 7.3
Time: 5.4s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\frac{x + y}{1 - \frac{y}{z}}\]
\frac{x + y}{1 - \frac{y}{z}}
\frac{x + y}{1 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r391318 = x;
        double r391319 = y;
        double r391320 = r391318 + r391319;
        double r391321 = 1.0;
        double r391322 = z;
        double r391323 = r391319 / r391322;
        double r391324 = r391321 - r391323;
        double r391325 = r391320 / r391324;
        return r391325;
}

double f(double x, double y, double z) {
        double r391326 = x;
        double r391327 = y;
        double r391328 = r391326 + r391327;
        double r391329 = 1.0;
        double r391330 = z;
        double r391331 = r391327 / r391330;
        double r391332 = r391329 - r391331;
        double r391333 = r391328 / r391332;
        return r391333;
}

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
Target3.7
Herbie7.3
\[\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. Final simplification7.3

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

Reproduce

herbie shell --seed 1978988140 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
  :precision binary64

  :herbie-target
  (if (< y -3.74293107626898565e171) (* (/ (+ y x) (- y)) z) (if (< y 3.55346624560867344e168) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z)))

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