Average Error: 6.7 → 0.9
Time: 3.9s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t) {
	return ((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t)))) <= -2.455780809786678e+294) || !(((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t)))) <= 3.1073838563848064e+301))) {
		VAR = ((double) (x + ((double) (y * ((double) (((double) (z - x)) / t))))));
	} else {
		VAR = ((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.7
Target2.1
Herbie0.9
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (+ x (/ (* y (- z x)) t)) < -2.455780809786678e294 or 3.1073838563848064e301 < (+ x (/ (* y (- z x)) t))

    1. Initial program 54.2

      \[\]
    2. Simplified2.8

      \[\leadsto \]

    if -2.455780809786678e294 < (+ x (/ (* y (- z x)) t)) < 3.1073838563848064e301

    1. Initial program 0.7

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

    \[\leadsto \]

Reproduce

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

  :herbie-target
  (- x (+ (* x (/ y t)) (* (neg z) (/ y t))))

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