Average Error: 7.4 → 7.4
Time: 17.8s
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 r28440028 = x;
        double r28440029 = y;
        double r28440030 = r28440028 + r28440029;
        double r28440031 = 1.0;
        double r28440032 = z;
        double r28440033 = r28440029 / r28440032;
        double r28440034 = r28440031 - r28440033;
        double r28440035 = r28440030 / r28440034;
        return r28440035;
}

double f(double x, double y, double z) {
        double r28440036 = y;
        double r28440037 = x;
        double r28440038 = r28440036 + r28440037;
        double r28440039 = 1.0;
        double r28440040 = z;
        double r28440041 = r28440036 / r28440040;
        double r28440042 = r28440039 - r28440041;
        double r28440043 = r28440038 / r28440042;
        return r28440043;
}

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

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

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

Reproduce

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