Average Error: 26.5 → 21.2
Time: 6.6s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t, double a, double b) {
	return ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b)))) / ((double) (((double) (x + t)) + y))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if ((y <= -9.29290126317176e+268)) {
		VAR = ((double) (a - ((double) (((double) (y / ((double) (x + ((double) (y + t)))))) * b))));
	} else {
		double VAR_1;
		if ((y <= -1.0983460863810735e+107)) {
			VAR_1 = ((double) (z - ((double) (((double) (y / ((double) (x + ((double) (y + t)))))) * b))));
		} else {
			double VAR_2;
			if ((y <= -4.5819374850263585e-19)) {
				VAR_2 = ((double) (a - ((double) (((double) (y / ((double) (x + ((double) (y + t)))))) * b))));
			} else {
				double VAR_3;
				if ((y <= -1.5423588976184654e-275)) {
					VAR_3 = ((double) (((double) (((double) (((double) (z * ((double) (y + x)))) + ((double) (a * ((double) (y + t)))))) - ((double) (y * b)))) * ((double) (1.0 / ((double) (x + ((double) (y + t))))))));
				} else {
					double VAR_4;
					if ((y <= 7.975561165301613e-292)) {
						VAR_4 = ((double) (z - ((double) (((double) (y / ((double) (x + ((double) (y + t)))))) * b))));
					} else {
						double VAR_5;
						if ((y <= 2.5716199698900055e+112)) {
							VAR_5 = ((double) (((double) (((double) (((double) (z * ((double) (y + x)))) + ((double) (a * ((double) (y + t)))))) / ((double) (x + ((double) (y + t)))))) - ((double) (((double) (((double) (((double) cbrt(y)) * ((double) cbrt(y)))) / ((double) (((double) cbrt(((double) (x + ((double) (y + t)))))) * ((double) cbrt(((double) (x + ((double) (y + t)))))))))) * ((double) (b * ((double) (((double) cbrt(y)) / ((double) cbrt(((double) (x + ((double) (y + t))))))))))))));
						} else {
							VAR_5 = ((double) (a - ((double) (((double) (y / ((double) (x + ((double) (y + t)))))) * b))));
						}
						VAR_4 = VAR_5;
					}
					VAR_3 = VAR_4;
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		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

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original26.5
Target11.3
Herbie21.2
\[\]

Derivation

  1. Split input into 4 regimes
  2. if y < -9.29290126317176004e268 or -1.09834608638107346e107 < y < -4.5819374850263585e-19 or 2.57161996989000555e112 < y

    1. Initial program 38.6

      \[\]
    2. Using strategy rm
    3. Applied div-sub38.6

      \[\leadsto \]
    4. Simplified38.6

      \[\leadsto \]
    5. Simplified31.7

      \[\leadsto \]
    6. Taylor expanded around 0 26.5

      \[\leadsto \]

    if -9.29290126317176004e268 < y < -1.09834608638107346e107 or -1.5423588976184654e-275 < y < 7.97556116530161278e-292

    1. Initial program 36.9

      \[\]
    2. Using strategy rm
    3. Applied div-sub36.9

      \[\leadsto \]
    4. Simplified36.9

      \[\leadsto \]
    5. Simplified31.1

      \[\leadsto \]
    6. Taylor expanded around inf 28.6

      \[\leadsto \]

    if -4.5819374850263585e-19 < y < -1.5423588976184654e-275

    1. Initial program 15.5

      \[\]
    2. Using strategy rm
    3. Applied div-inv15.6

      \[\leadsto \]
    4. Simplified15.6

      \[\leadsto \]

    if 7.97556116530161278e-292 < y < 2.57161996989000555e112

    1. Initial program 17.0

      \[\]
    2. Using strategy rm
    3. Applied div-sub17.0

      \[\leadsto \]
    4. Simplified17.0

      \[\leadsto \]
    5. Simplified16.3

      \[\leadsto \]
    6. Using strategy rm
    7. Applied add-cube-cbrt16.5

      \[\leadsto \]
    8. Applied add-cube-cbrt16.5

      \[\leadsto \]
    9. Applied times-frac16.5

      \[\leadsto \]
    10. Applied associate-*l*16.0

      \[\leadsto \]
    11. Simplified16.0

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020192 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
  :precision binary64

  :herbie-target
  (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3.5813117084150564e+153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e+82) (/ 1.0 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b)))

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