Average Error: 26.8 → 1.5
Time: 7.3s
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)\\ a \cdot \left(\frac{y}{t_1} + \frac{t}{t_1}\right) + \left(\frac{y + x}{x + \left(y + t\right)} \cdot z - \frac{y}{\frac{t_1}{b}}\right) \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))))
   (+
    (* a (+ (/ y t_1) (/ t t_1)))
    (- (* (/ (+ y x) (+ x (+ y t))) z) (/ y (/ t_1 b))))))
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);
	return (a * ((y / t_1) + (t / t_1))) + ((((y + x) / (x + (y + t))) * z) - (y / (t_1 / b)));
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    t_1 = y + (t + x)
    code = (a * ((y / t_1) + (t / t_1))) + ((((y + x) / (x + (y + t))) * z) - (y / (t_1 / b)))
end function
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);
	return (a * ((y / t_1) + (t / t_1))) + ((((y + x) / (x + (y + t))) * z) - (y / (t_1 / b)));
}
def code(x, y, z, t, a, b):
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
def code(x, y, z, t, a, b):
	t_1 = y + (t + x)
	return (a * ((y / t_1) + (t / t_1))) + ((((y + x) / (x + (y + t))) * z) - (y / (t_1 / b)))
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))
	return Float64(Float64(a * Float64(Float64(y / t_1) + Float64(t / t_1))) + Float64(Float64(Float64(Float64(y + x) / Float64(x + Float64(y + t))) * z) - Float64(y / Float64(t_1 / b))))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
end
function tmp = code(x, y, z, t, a, b)
	t_1 = y + (t + x);
	tmp = (a * ((y / t_1) + (t / t_1))) + ((((y + x) / (x + (y + t))) * z) - (y / (t_1 / b)));
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]}, N[(N[(a * N[(N[(y / t$95$1), $MachinePrecision] + N[(t / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(y + x), $MachinePrecision] / N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - N[(y / N[(t$95$1 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\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)\\
a \cdot \left(\frac{y}{t_1} + \frac{t}{t_1}\right) + \left(\frac{y + x}{x + \left(y + t\right)} \cdot z - \frac{y}{\frac{t_1}{b}}\right)
\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original26.8
Target11.5
Herbie1.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} < -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. Initial program 26.8

    \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
  2. Taylor expanded in a around 0 19.0

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

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

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

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

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

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

Reproduce

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