Average Error: 7.7 → 0.2
Time: 3.4s
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 (((((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z)))))) <= -8.809062442317445e-299) || !(((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z)))))) <= 0.0))) {
		VAR = ((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z))))));
	} else {
		VAR = ((double) (1.0 / ((double) (((double) (1.0 / ((double) (x + y)))) - ((double) (y / ((double) (((double) (x + y)) * z))))))));
	}
	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
Target3.7
Herbie0.2
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (+ x y) (- 1.0 (/ y z))) < -8.8090624423174451e-299 or 0.0 < (/ (+ x y) (- 1.0 (/ y z)))

    1. Initial program 0.1

      \[\]

    if -8.8090624423174451e-299 < (/ (+ x y) (- 1.0 (/ y z))) < 0.0

    1. Initial program 59.6

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

      \[\leadsto \]
    4. Using strategy rm
    5. Applied div-sub59.6

      \[\leadsto \]
    6. Simplified59.6

      \[\leadsto \]
    7. Simplified0.7

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

    \[\leadsto \]

Reproduce

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