Average Error: 6.4 → 0.7
Time: 4.9s
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) (y * ((double) (z - t)))) <= -1.962693662107902e+159)) {
		VAR = ((double) (x + ((double) (y * ((double) (((double) (t - z)) / a))))));
	} else {
		double VAR_1;
		if ((((double) (y * ((double) (z - t)))) <= 1.3288961013855822e+224)) {
			VAR_1 = ((double) (x - ((double) (1.0 / ((double) (a / ((double) (y * ((double) (z - t))))))))));
		} else {
			VAR_1 = ((double) (x - ((double) (((double) (z - t)) * ((double) (y / a))))));
		}
		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.9
Herbie0.7
\[\]

Derivation

  1. Split input into 3 regimes
  2. if (* y (- z t)) < -1.962693662107902e159

    1. Initial program 22.2

      \[\]
    2. Simplified1.8

      \[\leadsto \]

    if -1.962693662107902e159 < (* y (- z t)) < 1.32889610138558224e224

    1. Initial program 0.5

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

      \[\leadsto \]

    if 1.32889610138558224e224 < (* y (- z t))

    1. Initial program 34.3

      \[\]
    2. Using strategy rm
    3. Applied add-cube-cbrt34.6

      \[\leadsto \]
    4. Applied associate-/r*34.6

      \[\leadsto \]
    5. Simplified9.3

      \[\leadsto \]
    6. Using strategy rm
    7. Applied *-un-lft-identity9.3

      \[\leadsto \]
    8. Applied cbrt-prod9.3

      \[\leadsto \]
    9. Applied times-frac1.2

      \[\leadsto \]
    10. Simplified1.2

      \[\leadsto \]
    11. Simplified0.4

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020180 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
  :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)))