Average Error: 6.4 → 1.9
Time: 6.2s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (((double) (y * ((double) (z - t)))) / a))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if ((((double) (z - t)) <= -7.801339917478246e+140)) {
		VAR = ((double) (x + ((double) (((double) (z - t)) * ((double) (y / a))))));
	} else {
		double VAR_1;
		if ((((double) (z - t)) <= 7.123466189650817e-09)) {
			VAR_1 = ((double) (x + ((double) (y * ((double) (((double) (z - t)) / a))))));
		} else {
			double VAR_2;
			if ((((double) (z - t)) <= 3.383832292408153e+254)) {
				VAR_2 = ((double) (x + ((double) (((double) (z - t)) * ((double) (y / a))))));
			} else {
				VAR_2 = ((double) (x + ((double) (((double) (((double) cbrt(y)) * ((double) (((double) cbrt(y)) * ((double) sqrt(((double) (z - t)))))))) * ((double) (((double) sqrt(((double) (z - t)))) * ((double) (((double) cbrt(y)) / a))))))));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.4
Target0.8
Herbie1.9
\[\]

Derivation

  1. Split input into 3 regimes
  2. if (- z t) < -7.80133991747824628e140 or 7.12346618965081666e-9 < (- z t) < 3.3838322924081531e254

    1. Initial program 9.3

      \[\]
    2. Using strategy rm
    3. Applied associate-/l*8.3

      \[\leadsto \]
    4. Using strategy rm
    5. Applied associate-/r/1.7

      \[\leadsto \]

    if -7.80133991747824628e140 < (- z t) < 7.12346618965081666e-9

    1. Initial program 2.1

      \[\]
    2. Simplified1.9

      \[\leadsto \]

    if 3.3838322924081531e254 < (- z t)

    1. Initial program 15.0

      \[\]
    2. Using strategy rm
    3. Applied associate-/l*13.6

      \[\leadsto \]
    4. Using strategy rm
    5. Applied add-sqr-sqrt13.8

      \[\leadsto \]
    6. Applied *-un-lft-identity13.8

      \[\leadsto \]
    7. Applied times-frac13.7

      \[\leadsto \]
    8. Applied add-cube-cbrt14.1

      \[\leadsto \]
    9. Applied times-frac6.1

      \[\leadsto \]
    10. Simplified6.1

      \[\leadsto \]
    11. Simplified3.5

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.9

    \[\leadsto \]

Reproduce

herbie shell --seed 2020180 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :precision binary64

  :herbie-target
  (if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))

  (+ x (/ (* y (- z t)) a)))