Average Error: 26.4 → 21.5
Time: 8.4s
Precision: 64
\[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.27341593101006445 \cdot 10^{180}:\\ \;\;\;\;a - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le -3.9930459557533415 \cdot 10^{-21}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 4.776511014458635 \cdot 10^{-298}:\\ \;\;\;\;z - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 8.26703641181714224 \cdot 10^{-33}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 1.3318142435851507 \cdot 10^{60}:\\ \;\;\;\;z - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;a - b \cdot \frac{y}{\left(x + t\right) + y}\\ \end{array}\]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\begin{array}{l}
\mathbf{if}\;t \le -1.27341593101006445 \cdot 10^{180}:\\
\;\;\;\;a - b \cdot \frac{y}{\left(x + t\right) + y}\\

\mathbf{elif}\;t \le -3.9930459557533415 \cdot 10^{-21}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - b \cdot \frac{y}{\left(x + t\right) + y}\\

\mathbf{elif}\;t \le 4.776511014458635 \cdot 10^{-298}:\\
\;\;\;\;z - b \cdot \frac{y}{\left(x + t\right) + y}\\

\mathbf{elif}\;t \le 8.26703641181714224 \cdot 10^{-33}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - b \cdot \frac{y}{\left(x + t\right) + y}\\

\mathbf{elif}\;t \le 1.3318142435851507 \cdot 10^{60}:\\
\;\;\;\;z - b \cdot \frac{y}{\left(x + t\right) + y}\\

\mathbf{else}:\\
\;\;\;\;a - b \cdot \frac{y}{\left(x + t\right) + y}\\

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return (((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y));
}
double code(double x, double y, double z, double t, double a, double b) {
	double temp;
	if ((t <= -1.2734159310100645e+180)) {
		temp = (a - (b * (y / ((x + t) + y))));
	} else {
		double temp_1;
		if ((t <= -3.9930459557533415e-21)) {
			temp_1 = (((fma((x + y), z, ((t + y) * a)) / 1.0) / ((x + t) + y)) - (b * (y / ((x + t) + y))));
		} else {
			double temp_2;
			if ((t <= 4.7765110144586345e-298)) {
				temp_2 = (z - (b * (y / ((x + t) + y))));
			} else {
				double temp_3;
				if ((t <= 8.267036411817142e-33)) {
					temp_3 = (((fma((x + y), z, ((t + y) * a)) / 1.0) / ((x + t) + y)) - (b * (y / ((x + t) + y))));
				} else {
					double temp_4;
					if ((t <= 1.3318142435851507e+60)) {
						temp_4 = (z - (b * (y / ((x + t) + y))));
					} else {
						temp_4 = (a - (b * (y / ((x + t) + y))));
					}
					temp_3 = temp_4;
				}
				temp_2 = temp_3;
			}
			temp_1 = temp_2;
		}
		temp = temp_1;
	}
	return temp;
}

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.4
Target11.2
Herbie21.5
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt -3.5813117084150564 \cdot 10^{153}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt 1.2285964308315609 \cdot 10^{82}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -1.2734159310100645e+180 or 1.3318142435851507e+60 < t

    1. Initial program 34.1

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied div-sub34.1

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Simplified34.1

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity34.1

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    7. Applied *-commutative34.1

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\color{blue}{b \cdot y}}{1 \cdot \left(\left(x + t\right) + y\right)}\]
    8. Applied times-frac31.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{b}{1} \cdot \frac{y}{\left(x + t\right) + y}}\]
    9. Simplified31.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{b} \cdot \frac{y}{\left(x + t\right) + y}\]
    10. Taylor expanded around 0 21.8

      \[\leadsto \color{blue}{a} - b \cdot \frac{y}{\left(x + t\right) + y}\]

    if -1.2734159310100645e+180 < t < -3.9930459557533415e-21 or 4.7765110144586345e-298 < t < 8.267036411817142e-33

    1. Initial program 23.5

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied div-sub23.5

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Simplified23.5

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity23.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    7. Applied *-commutative23.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\color{blue}{b \cdot y}}{1 \cdot \left(\left(x + t\right) + y\right)}\]
    8. Applied times-frac20.7

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{b}{1} \cdot \frac{y}{\left(x + t\right) + y}}\]
    9. Simplified20.7

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{b} \cdot \frac{y}{\left(x + t\right) + y}\]

    if -3.9930459557533415e-21 < t < 4.7765110144586345e-298 or 8.267036411817142e-33 < t < 1.3318142435851507e+60

    1. Initial program 22.3

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied div-sub22.3

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Simplified22.3

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity22.3

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    7. Applied *-commutative22.3

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\color{blue}{b \cdot y}}{1 \cdot \left(\left(x + t\right) + y\right)}\]
    8. Applied times-frac18.9

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{b}{1} \cdot \frac{y}{\left(x + t\right) + y}}\]
    9. Simplified18.9

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{b} \cdot \frac{y}{\left(x + t\right) + y}\]
    10. Taylor expanded around inf 22.1

      \[\leadsto \color{blue}{z} - b \cdot \frac{y}{\left(x + t\right) + y}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification21.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.27341593101006445 \cdot 10^{180}:\\ \;\;\;\;a - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le -3.9930459557533415 \cdot 10^{-21}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 4.776511014458635 \cdot 10^{-298}:\\ \;\;\;\;z - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 8.26703641181714224 \cdot 10^{-33}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 1.3318142435851507 \cdot 10^{60}:\\ \;\;\;\;z - b \cdot \frac{y}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;a - b \cdot \frac{y}{\left(x + t\right) + y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020066 +o rules:numerics
(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 (/ (+ (+ 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)))