Average Error: 7.7 → 2.6
Time: 3.0s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z) {
	return ((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z))))));
}
double code(double x, double y, double z) {
	double VAR;
	if (((z <= -2.4417521594819806e+43) || !(z <= 3.739290546816909e+57))) {
		VAR = ((double) (((double) (x + y)) * ((double) (1.0 / ((double) (1.0 - ((double) (y / z))))))));
	} else {
		VAR = ((double) (1.0 / ((double) (((double) (1.0 / ((double) (x + y)))) - ((double) (y / ((double) (z * ((double) (x + y))))))))));
	}
	return VAR;
}

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.7
Target4.2
Herbie2.6
\[\]

Derivation

  1. Split input into 2 regimes
  2. if z < -2.4417521594819806e43 or 3.7392905468169088e57 < z

    1. Initial program 0.0

      \[\]
    2. Using strategy rm
    3. Applied div-inv0.1

      \[\leadsto \]

    if -2.4417521594819806e43 < z < 3.7392905468169088e57

    1. Initial program 13.0

      \[\]
    2. Using strategy rm
    3. Applied clear-num13.2

      \[\leadsto \]
    4. Using strategy rm
    5. Applied div-sub13.2

      \[\leadsto \]
    6. Simplified13.2

      \[\leadsto \]
    7. Simplified4.4

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.6

    \[\leadsto \]

Reproduce

herbie shell --seed 2020179 
(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) (neg y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (neg y)) z)))

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