Average Error: 7.4 → 7.4
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 r2087979 = x;
        double r2087980 = y;
        double r2087981 = r2087979 + r2087980;
        double r2087982 = 1.0;
        double r2087983 = z;
        double r2087984 = r2087980 / r2087983;
        double r2087985 = r2087982 - r2087984;
        double r2087986 = r2087981 / r2087985;
        return r2087986;
}

double f(double x, double y, double z) {
        double r2087987 = x;
        double r2087988 = y;
        double r2087989 = r2087987 + r2087988;
        double r2087990 = 1.0;
        double r2087991 = z;
        double r2087992 = r2087988 / r2087991;
        double r2087993 = r2087990 - r2087992;
        double r2087994 = r2087989 / r2087993;
        return r2087994;
}

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

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

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

Reproduce

herbie shell --seed 2020018 +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))))