Average Error: 7.9 → 0.9
Time: 7.0s
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) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) / ((double) (a * 2.0)))) <= -inf.0)) {
		VAR = ((double) (((double) (0.5 * ((double) (y * ((double) (x / a)))))) - ((double) (((double) (z * 4.5)) * ((double) (t / a))))));
	} else {
		double VAR_1;
		if ((((double) (((double) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) / ((double) (a * 2.0)))) <= 3.5548775760326213e+307)) {
			VAR_1 = ((double) (((double) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) / ((double) (a * 2.0))));
		} else {
			VAR_1 = ((double) (((double) (0.5 * ((double) (y * ((double) (x / a)))))) - ((double) (4.5 * ((double) (((double) cbrt(((double) (t / a)))) * ((double) (z * ((double) (((double) cbrt(((double) (t / a)))) * ((double) cbrt(((double) (t / 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

Original7.9
Target6.0
Herbie0.9
\[\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)) < -inf.0

    1. Initial program 64.0

      \[\]
    2. Taylor expanded around 0 62.6

      \[\leadsto \]
    3. Simplified0.6

      \[\leadsto \]
    4. Using strategy rm
    5. Applied associate-*r*1.6

      \[\leadsto \]
    6. Simplified1.6

      \[\leadsto \]

    if -inf.0 < (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)) < 3.55487757603262127e307

    1. Initial program 0.8

      \[\]

    if 3.55487757603262127e307 < (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0))

    1. Initial program 63.0

      \[\]
    2. Taylor expanded around 0 62.3

      \[\leadsto \]
    3. Simplified1.2

      \[\leadsto \]
    4. Using strategy rm
    5. Applied add-cube-cbrt1.8

      \[\leadsto \]
    6. Applied associate-*r*1.8

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020192 
(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)))