Average Error: 7.7 → 7.7
Time: 4.5s
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 r369273 = x;
        double r369274 = y;
        double r369275 = r369273 + r369274;
        double r369276 = 1.0;
        double r369277 = z;
        double r369278 = r369274 / r369277;
        double r369279 = r369276 - r369278;
        double r369280 = r369275 / r369279;
        return r369280;
}

double f(double x, double y, double z) {
        double r369281 = x;
        double r369282 = y;
        double r369283 = r369281 + r369282;
        double r369284 = 1.0;
        double r369285 = z;
        double r369286 = r369282 / r369285;
        double r369287 = r369284 - r369286;
        double r369288 = r369283 / r369287;
        return r369288;
}

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.7
Target4.2
Herbie7.7
\[\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.7

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

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

Reproduce

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