Average Error: 3.6 → 0.6
Time: 5.1s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t) {
	return ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (t / ((double) (((double) (z * 3.0)) * y))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((t <= -1.9756495134823586e-122) || !(t <= 8.566572551246772e+57))) {
		VAR = ((double) (((double) (x + ((double) (((double) (y / 3.0)) * ((double) (-1.0 / z)))))) + ((double) (t / ((double) (y * ((double) (z * 3.0))))))));
	} else {
		VAR = ((double) (x + ((double) (((double) (((double) (t / y)) - y)) / ((double) (z * 3.0))))));
	}
	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

Original3.6
Target1.8
Herbie0.6
\[\]

Derivation

  1. Split input into 2 regimes
  2. if t < -1.9756495134823586e-122 or 8.56657255124677238e57 < t

    1. Initial program 1.0

      \[\]
    2. Using strategy rm
    3. Applied *-un-lft-identity1.0

      \[\leadsto \]
    4. Applied times-frac1.0

      \[\leadsto \]

    if -1.9756495134823586e-122 < t < 8.56657255124677238e57

    1. Initial program 6.0

      \[\]
    2. Simplified0.3

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

    \[\leadsto \]

Reproduce

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

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

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