Average Error: 26.6 → 22.1
Time: 7.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 ((t <= -2.0894007945644426e+111)) {
		VAR = ((double) (a - ((double) (((double) (y / ((double) (x + ((double) (t + y)))))) * b))));
	} else {
		double VAR_1;
		if ((t <= -1.553899553817351e+25)) {
			VAR_1 = ((double) (1.0 / ((double) (((double) (x + ((double) (t + y)))) / ((double) (((double) (((double) (y + x)) * z)) + ((double) (((double) (t * a)) + ((double) (y * ((double) (a - b))))))))))));
		} else {
			double VAR_2;
			if ((t <= 2.3708825286757182e-225)) {
				VAR_2 = ((double) (z - ((double) (((double) (y / ((double) (x + ((double) (t + y)))))) * b))));
			} else {
				double VAR_3;
				if ((t <= 3.292261846139531e-33)) {
					VAR_3 = ((double) (((double) (((double) (((double) (((double) (y + x)) * z)) + ((double) (a * ((double) (t + y)))))) - ((double) (y * b)))) * ((double) (1.0 / ((double) (x + ((double) (t + y))))))));
				} else {
					double VAR_4;
					if ((t <= 1.0903062726921077e+42)) {
						VAR_4 = ((double) (z - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
					} else {
						double VAR_5;
						if ((t <= 5.323893389779894e+69)) {
							VAR_5 = ((double) (1.0 / ((double) (((double) (x + ((double) (t + y)))) / ((double) (((double) (((double) (y + x)) * z)) + ((double) (((double) (t * a)) + ((double) (y * ((double) (a - b))))))))))));
						} else {
							VAR_5 = ((double) (a - ((double) (((double) (y / ((double) (x + ((double) (t + y)))))) * 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.6
Target11.2
Herbie22.1
\[\]

Derivation

  1. Split input into 5 regimes
  2. if t < -2.0894007945644426e111 or 5.32389338977989437e69 < t

    1. Initial program 33.8

      \[\]
    2. Using strategy rm
    3. Applied div-sub33.8

      \[\leadsto \]
    4. Simplified33.8

      \[\leadsto \]
    5. Simplified31.1

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

      \[\leadsto \]

    if -2.0894007945644426e111 < t < -1.55389955381735095e25 or 1.0903062726921077e42 < t < 5.32389338977989437e69

    1. Initial program 23.6

      \[\]
    2. Using strategy rm
    3. Applied clear-num23.6

      \[\leadsto \]
    4. Simplified23.6

      \[\leadsto \]

    if -1.55389955381735095e25 < t < 2.37088252867571821e-225

    1. Initial program 22.7

      \[\]
    2. Using strategy rm
    3. Applied div-sub22.7

      \[\leadsto \]
    4. Simplified22.7

      \[\leadsto \]
    5. Simplified19.3

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

      \[\leadsto \]

    if 2.37088252867571821e-225 < t < 3.2922618461395312e-33

    1. Initial program 21.4

      \[\]
    2. Using strategy rm
    3. Applied div-inv21.5

      \[\leadsto \]
    4. Simplified21.5

      \[\leadsto \]

    if 3.2922618461395312e-33 < t < 1.0903062726921077e42

    1. Initial program 24.3

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

      \[\leadsto \]
    4. Simplified24.3

      \[\leadsto \]
    5. Simplified21.1

      \[\leadsto \]
    6. Using strategy rm
    7. Applied div-inv21.2

      \[\leadsto \]
    8. Applied associate-*l*21.3

      \[\leadsto \]
    9. Simplified21.3

      \[\leadsto \]
    10. Taylor expanded around inf 28.0

      \[\leadsto \]
  3. Recombined 5 regimes into one program.
  4. Final simplification22.1

    \[\leadsto \]

Reproduce

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