Average Error: 6.8 → 6.8
Time: 16.4s
Precision: 64
\[\frac{x + y}{1.0 - \frac{y}{z}}\]
\[\frac{y + x}{1.0 - \frac{y}{z}}\]
\frac{x + y}{1.0 - \frac{y}{z}}
\frac{y + x}{1.0 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r19804428 = x;
        double r19804429 = y;
        double r19804430 = r19804428 + r19804429;
        double r19804431 = 1.0;
        double r19804432 = z;
        double r19804433 = r19804429 / r19804432;
        double r19804434 = r19804431 - r19804433;
        double r19804435 = r19804430 / r19804434;
        return r19804435;
}

double f(double x, double y, double z) {
        double r19804436 = y;
        double r19804437 = x;
        double r19804438 = r19804436 + r19804437;
        double r19804439 = 1.0;
        double r19804440 = z;
        double r19804441 = r19804436 / r19804440;
        double r19804442 = r19804439 - r19804441;
        double r19804443 = r19804438 / r19804442;
        return r19804443;
}

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

Original6.8
Target3.9
Herbie6.8
\[\begin{array}{l} \mathbf{if}\;y \lt -3.7429310762689856 \cdot 10^{+171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.5534662456086734 \cdot 10^{+168}:\\ \;\;\;\;\frac{x + y}{1.0 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \end{array}\]

Derivation

  1. Initial program 6.8

    \[\frac{x + y}{1.0 - \frac{y}{z}}\]
  2. Final simplification6.8

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

Reproduce

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