Average Error: 7.2 → 0.2
Time: 3.3s
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 (((y <= -9.758205958506859e-13) || !(y <= 1.512215892997768e-22))) {
		VAR = ((double) (1.0 / ((double) (((double) (1.0 / ((double) (y + x)))) + ((double) (((double) (y / ((double) (y + x)))) * ((double) (-1.0 / z))))))));
	} else {
		VAR = ((double) (((double) (y + x)) * ((double) (1.0 / ((double) (1.0 - ((double) (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.2
Target3.9
Herbie0.2
\[\]

Derivation

  1. Split input into 2 regimes
  2. if y < -9.75820595850685867e-13 or 1.51221589299777e-22 < y

    1. Initial program 13.6

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

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

      \[\leadsto \]
    6. Simplified13.7

      \[\leadsto \]
    7. Simplified9.0

      \[\leadsto \]
    8. Using strategy rm
    9. Applied *-un-lft-identity9.0

      \[\leadsto \]
    10. Applied times-frac0.2

      \[\leadsto \]

    if -9.75820595850685867e-13 < y < 1.51221589299777e-22

    1. Initial program 0.1

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

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

    \[\leadsto \]

Reproduce

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