Average Error: 7.5 → 1.2
Time: 6.6s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t, double a) {
	return ((double) (((double) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) / ((double) (a * 2.0))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((((double) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) <= -8.078375618961065e+238) || !(((double) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) <= 5.092587275445933e+178))) {
		VAR = ((double) (((double) (y * ((double) (x / ((double) (a * 2.0)))))) - ((double) (((double) (9.0 * t)) * ((double) (z / ((double) (a * 2.0))))))));
	} else {
		VAR = ((double) (((double) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) / ((double) (a * 2.0))));
	}
	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

Original7.5
Target5.4
Herbie1.2
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -8.0783756189610653e238 or 5.0925872754459327e178 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 28.9

      \[\]
    2. Simplified29.0

      \[\leadsto \]
    3. Using strategy rm
    4. Applied div-sub29.0

      \[\leadsto \]
    5. Simplified17.1

      \[\leadsto \]
    6. Simplified1.9

      \[\leadsto \]

    if -8.0783756189610653e238 < (- (* x y) (* (* z 9.0) t)) < 5.0925872754459327e178

    1. Initial program 0.9

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020181 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"
  :precision binary64

  :herbie-target
  (if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))