Average Error: 7.6 → 1.0
Time: 5.3s
Precision: binary64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
\[\begin{array}{l} t_1 := z \cdot t - x\\ \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t_1}}{x + 1} \leq \infty:\\ \;\;\;\;\frac{x + \left(\frac{y}{\frac{t_1}{z}} - \frac{x}{t_1}\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* z t) x)))
   (if (<= (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0)) INFINITY)
     (/ (+ x (- (/ y (/ t_1 z)) (/ x t_1))) (+ x 1.0))
     (/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
	return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double tmp;
	if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= ((double) INFINITY)) {
		tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0);
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double tmp;
	if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Double.POSITIVE_INFINITY) {
		tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0);
	} else {
		tmp = (x + (y / t)) / (x + 1.0);
	}
	return tmp;
}
def code(x, y, z, t):
	return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
def code(x, y, z, t):
	t_1 = (z * t) - x
	tmp = 0
	if ((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= math.inf:
		tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0)
	else:
		tmp = (x + (y / t)) / (x + 1.0)
	return tmp
function code(x, y, z, t)
	return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0))
end
function code(x, y, z, t)
	t_1 = Float64(Float64(z * t) - x)
	tmp = 0.0
	if (Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) <= Inf)
		tmp = Float64(Float64(x + Float64(Float64(y / Float64(t_1 / z)) - Float64(x / t_1))) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * t) - x;
	tmp = 0.0;
	if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Inf)
		tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0);
	else
		tmp = (x + (y / t)) / (x + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x + N[(N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
t_1 := z \cdot t - x\\
\mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t_1}}{x + 1} \leq \infty:\\
\;\;\;\;\frac{x + \left(\frac{y}{\frac{t_1}{z}} - \frac{x}{t_1}\right)}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.6
Target0.4
Herbie1.0
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1} \]

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0

    1. Initial program 5.0

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Taylor expanded in y around 0 5.0

      \[\leadsto \frac{x + \color{blue}{\left(\frac{y \cdot z}{t \cdot z - x} - \frac{x}{t \cdot z - x}\right)}}{x + 1} \]
    3. Simplified1.1

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

    if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 64.0

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Applied egg-rr64.0

      \[\leadsto \frac{x + \color{blue}{\left(y \cdot z - x\right) \cdot \frac{1}{z \cdot t - x}}}{x + 1} \]
    3. Applied egg-rr64.0

      \[\leadsto \frac{x + \color{blue}{\frac{1}{\frac{z \cdot t - x}{y \cdot z - x}}}}{x + 1} \]
    4. Taylor expanded in z around inf 0.0

      \[\leadsto \color{blue}{\frac{\frac{y}{t} + x}{1 + x}} \]
    5. Simplified0.0

      \[\leadsto \color{blue}{\frac{x + \frac{y}{t}}{1 + x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq \infty:\\ \;\;\;\;\frac{x + \left(\frac{y}{\frac{z \cdot t - x}{z}} - \frac{x}{z \cdot t - x}\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]

Reproduce

herbie shell --seed 2022151 
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))

  (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))