Average Error: 7.8 → 7.8
Time: 3.6s
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 r704173 = x;
        double r704174 = y;
        double r704175 = r704173 + r704174;
        double r704176 = 1.0;
        double r704177 = z;
        double r704178 = r704174 / r704177;
        double r704179 = r704176 - r704178;
        double r704180 = r704175 / r704179;
        return r704180;
}

double f(double x, double y, double z) {
        double r704181 = x;
        double r704182 = y;
        double r704183 = r704181 + r704182;
        double r704184 = 1.0;
        double r704185 = z;
        double r704186 = r704182 / r704185;
        double r704187 = r704184 - r704186;
        double r704188 = r704183 / r704187;
        return r704188;
}

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.8
Target4.3
Herbie7.8
\[\begin{array}{l} \mathbf{if}\;y \lt -3.74293107626898565 \cdot 10^{171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.55346624560867344 \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.8

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

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

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(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.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z)))

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