Average Error: 7.6 → 7.6
Time: 12.0s
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 r587317 = x;
        double r587318 = y;
        double r587319 = r587317 + r587318;
        double r587320 = 1.0;
        double r587321 = z;
        double r587322 = r587318 / r587321;
        double r587323 = r587320 - r587322;
        double r587324 = r587319 / r587323;
        return r587324;
}

double f(double x, double y, double z) {
        double r587325 = x;
        double r587326 = y;
        double r587327 = r587325 + r587326;
        double r587328 = 1.0;
        double r587329 = z;
        double r587330 = r587326 / r587329;
        double r587331 = r587328 - r587330;
        double r587332 = r587327 / r587331;
        return r587332;
}

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

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

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

Reproduce

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