Average Error: 27.1 → 7.0
Time: 12.4s
Precision: binary64
\[\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} t_1 := y + \left(t + x\right)\\ t_2 := \sqrt[3]{t_1}\\ t_3 := \left(a + z\right) - b\\ \mathbf{if}\;y \leq -9.070353256782471 \cdot 10^{+119}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 1.7234148892206226 \cdot 10^{+128}:\\ \;\;\;\;\left(\frac{y \cdot z}{t_1} + \left(z \cdot \frac{x}{t_1} + \left(a \cdot \frac{t}{t + \left(y + x\right)} + \frac{y \cdot a}{t_1}\right)\right)\right) - \frac{b \cdot \frac{y}{t_2 \cdot t_2}}{t_2}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ y (+ t x))) (t_2 (cbrt t_1)) (t_3 (- (+ a z) b)))
   (if (<= y -9.070353256782471e+119)
     t_3
     (if (<= y 1.7234148892206226e+128)
       (-
        (+
         (/ (* y z) t_1)
         (+ (* z (/ x t_1)) (+ (* a (/ t (+ t (+ y x)))) (/ (* y a) t_1))))
        (/ (* b (/ y (* t_2 t_2))) t_2))
       t_3))))
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 t_1 = y + (t + x);
	double t_2 = cbrt(t_1);
	double t_3 = (a + z) - b;
	double tmp;
	if (y <= -9.070353256782471e+119) {
		tmp = t_3;
	} else if (y <= 1.7234148892206226e+128) {
		tmp = (((y * z) / t_1) + ((z * (x / t_1)) + ((a * (t / (t + (y + x)))) + ((y * a) / t_1)))) - ((b * (y / (t_2 * t_2))) / t_2);
	} else {
		tmp = t_3;
	}
	return tmp;
}
public static 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);
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = y + (t + x);
	double t_2 = Math.cbrt(t_1);
	double t_3 = (a + z) - b;
	double tmp;
	if (y <= -9.070353256782471e+119) {
		tmp = t_3;
	} else if (y <= 1.7234148892206226e+128) {
		tmp = (((y * z) / t_1) + ((z * (x / t_1)) + ((a * (t / (t + (y + x)))) + ((y * a) / t_1)))) - ((b * (y / (t_2 * t_2))) / t_2);
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
end
function code(x, y, z, t, a, b)
	t_1 = Float64(y + Float64(t + x))
	t_2 = cbrt(t_1)
	t_3 = Float64(Float64(a + z) - b)
	tmp = 0.0
	if (y <= -9.070353256782471e+119)
		tmp = t_3;
	elseif (y <= 1.7234148892206226e+128)
		tmp = Float64(Float64(Float64(Float64(y * z) / t_1) + Float64(Float64(z * Float64(x / t_1)) + Float64(Float64(a * Float64(t / Float64(t + Float64(y + x)))) + Float64(Float64(y * a) / t_1)))) - Float64(Float64(b * Float64(y / Float64(t_2 * t_2))) / t_2));
	else
		tmp = t_3;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(t + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1/3], $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -9.070353256782471e+119], t$95$3, If[LessEqual[y, 1.7234148892206226e+128], N[(N[(N[(N[(y * z), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(z * N[(x / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(t / N[(t + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y * a), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(y / N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\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}
t_1 := y + \left(t + x\right)\\
t_2 := \sqrt[3]{t_1}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -9.070353256782471 \cdot 10^{+119}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;y \leq 1.7234148892206226 \cdot 10^{+128}:\\
\;\;\;\;\left(\frac{y \cdot z}{t_1} + \left(z \cdot \frac{x}{t_1} + \left(a \cdot \frac{t}{t + \left(y + x\right)} + \frac{y \cdot a}{t_1}\right)\right)\right) - \frac{b \cdot \frac{y}{t_2 \cdot t_2}}{t_2}\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}

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

Original27.1
Target11.3
Herbie7.0
\[\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} < -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} < 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 2 regimes
  2. if y < -9.07035325678247137e119 or 1.72341488922062257e128 < y

    1. Initial program 46.7

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Simplified46.7

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

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]

    if -9.07035325678247137e119 < y < 1.72341488922062257e128

    1. Initial program 18.7

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Simplified18.7

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

      \[\leadsto \color{blue}{\left(\frac{y \cdot z}{y + \left(t + x\right)} + \left(\frac{z \cdot x}{y + \left(t + x\right)} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \frac{y \cdot a}{y + \left(t + x\right)}\right)\right)\right) - \frac{y \cdot b}{y + \left(t + x\right)}} \]
    4. Applied *-un-lft-identity_binary6418.7

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

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

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

      \[\leadsto \left(\frac{y \cdot z}{y + \left(t + x\right)} + \left(z \cdot \color{blue}{\frac{x}{y + \left(x + t\right)}} + \left(\frac{a \cdot t}{y + \left(t + x\right)} + \frac{y \cdot a}{y + \left(t + x\right)}\right)\right)\right) - \frac{y \cdot b}{y + \left(t + x\right)} \]
    8. Applied *-un-lft-identity_binary6412.4

      \[\leadsto \left(\frac{y \cdot z}{y + \left(t + x\right)} + \left(z \cdot \frac{x}{y + \left(x + t\right)} + \left(\frac{a \cdot t}{\color{blue}{1 \cdot \left(y + \left(t + x\right)\right)}} + \frac{y \cdot a}{y + \left(t + x\right)}\right)\right)\right) - \frac{y \cdot b}{y + \left(t + x\right)} \]
    9. Applied times-frac_binary645.6

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

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

      \[\leadsto \left(\frac{y \cdot z}{y + \left(t + x\right)} + \left(z \cdot \frac{x}{y + \left(x + t\right)} + \left(a \cdot \color{blue}{\frac{t}{t + \left(y + x\right)}} + \frac{y \cdot a}{y + \left(t + x\right)}\right)\right)\right) - \frac{y \cdot b}{y + \left(t + x\right)} \]
    12. Applied add-cube-cbrt_binary645.7

      \[\leadsto \left(\frac{y \cdot z}{y + \left(t + x\right)} + \left(z \cdot \frac{x}{y + \left(x + t\right)} + \left(a \cdot \frac{t}{t + \left(y + x\right)} + \frac{y \cdot a}{y + \left(t + x\right)}\right)\right)\right) - \frac{y \cdot b}{\color{blue}{\left(\sqrt[3]{y + \left(t + x\right)} \cdot \sqrt[3]{y + \left(t + x\right)}\right) \cdot \sqrt[3]{y + \left(t + x\right)}}} \]
    13. Applied associate-/r*_binary645.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.070353256782471 \cdot 10^{+119}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \leq 1.7234148892206226 \cdot 10^{+128}:\\ \;\;\;\;\left(\frac{y \cdot z}{y + \left(t + x\right)} + \left(z \cdot \frac{x}{y + \left(t + x\right)} + \left(a \cdot \frac{t}{t + \left(y + x\right)} + \frac{y \cdot a}{y + \left(t + x\right)}\right)\right)\right) - \frac{b \cdot \frac{y}{\sqrt[3]{y + \left(t + x\right)} \cdot \sqrt[3]{y + \left(t + x\right)}}}{\sqrt[3]{y + \left(t + x\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - b\\ \end{array} \]

Reproduce

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