Average Error: 7.5 → 7.5
Time: 21.9s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\frac{y + x}{1 - \frac{y}{z}}\]
\frac{x + y}{1 - \frac{y}{z}}
\frac{y + x}{1 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r22631209 = x;
        double r22631210 = y;
        double r22631211 = r22631209 + r22631210;
        double r22631212 = 1.0;
        double r22631213 = z;
        double r22631214 = r22631210 / r22631213;
        double r22631215 = r22631212 - r22631214;
        double r22631216 = r22631211 / r22631215;
        return r22631216;
}

double f(double x, double y, double z) {
        double r22631217 = y;
        double r22631218 = x;
        double r22631219 = r22631217 + r22631218;
        double r22631220 = 1.0;
        double r22631221 = z;
        double r22631222 = r22631217 / r22631221;
        double r22631223 = r22631220 - r22631222;
        double r22631224 = r22631219 / r22631223;
        return r22631224;
}

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

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

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

Reproduce

herbie shell --seed 2019171 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"

  :herbie-target
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))

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