Average Error: 2.1 → 1.7
Time: 3.5s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t) {
	return ((double) (((double) (((double) (x / y)) * ((double) (z - t)))) + t));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((y <= -1.0595863515421569e+87)) {
		VAR = ((double) (t + ((double) (x / ((double) (y / ((double) (z - t))))))));
	} else {
		double VAR_1;
		if ((y <= 3.007497839648298e-58)) {
			VAR_1 = ((double) (t + ((double) (((double) (x * ((double) (z - t)))) / y))));
		} else {
			VAR_1 = ((double) (t + ((double) (((double) (z - t)) * ((double) (x / y))))));
		}
		VAR = VAR_1;
	}
	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

Original2.1
Target2.4
Herbie1.7
\[\]

Derivation

  1. Split input into 3 regimes
  2. if y < -1.0595863515421569e87

    1. Initial program 1.5

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

      \[\leadsto \]
    4. Using strategy rm
    5. Applied associate-/l*1.5

      \[\leadsto \]

    if -1.0595863515421569e87 < y < 3.0074978396482981e-58

    1. Initial program 3.4

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

      \[\leadsto \]

    if 3.0074978396482981e-58 < y

    1. Initial program 1.1

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020190 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

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