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

\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;x + t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.1
Target1.3
Herbie0.3
\[x + \frac{y}{\frac{a - t}{z - t}} \]

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0 or 4.99999999999999991e295 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t))

    1. Initial program 62.5

      \[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
    2. Applied egg-rr0.8

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

    if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 4.99999999999999991e295

    1. Initial program 0.2

      \[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

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

Alternatives

Alternative 1
Error3.0
Cost1992
\[\begin{array}{l} t_1 := x + \left(z - t\right) \cdot \frac{y}{a - t}\\ t_2 := \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{if}\;t_2 \leq 5 \cdot 10^{+205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+295}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error18.2
Cost1764
\[\begin{array}{l} t_1 := x + \frac{z}{\frac{a - t}{y}}\\ t_2 := \frac{-y}{\frac{a}{t} + -1}\\ \mathbf{if}\;x \leq -3.632275279424997 \cdot 10^{-31}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.6534671389824252 \cdot 10^{-158}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq -2.485960554446742 \cdot 10^{-200}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.1934593230252892 \cdot 10^{-209}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.1153065462036609 \cdot 10^{-230}:\\ \;\;\;\;y \cdot \frac{-z}{t - a}\\ \mathbf{elif}\;x \leq -1.5888948230423007 \cdot 10^{-267}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.6603712900361585 \cdot 10^{-307}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 0.29623332822229353:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.2457461671107255 \cdot 10^{+64}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error20.3
Cost976
\[\begin{array}{l} t_1 := x - \frac{y \cdot t}{a}\\ \mathbf{if}\;a \leq -1.0442147176995317 \cdot 10^{+70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 8.8 \cdot 10^{-265}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq 1.1 \cdot 10^{-179}:\\ \;\;\;\;x - z \cdot \frac{y}{t}\\ \mathbf{elif}\;a \leq 5.261789708635957 \cdot 10^{+137}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error17.2
Cost976
\[\begin{array}{l} t_1 := x + \frac{z}{\frac{a}{y}}\\ \mathbf{if}\;a \leq -0.01025509647256459:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 8.8 \cdot 10^{-265}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq 1.1 \cdot 10^{-179}:\\ \;\;\;\;x - z \cdot \frac{y}{t}\\ \mathbf{elif}\;a \leq 1.6563556077943162 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error17.1
Cost976
\[\begin{array}{l} \mathbf{if}\;a \leq -0.01025509647256459:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{elif}\;a \leq 8.8 \cdot 10^{-265}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq 1.1 \cdot 10^{-179}:\\ \;\;\;\;x - z \cdot \frac{y}{t}\\ \mathbf{elif}\;a \leq 1.6563556077943162 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z}{\frac{a}{y}}\\ \end{array} \]
Alternative 6
Error8.3
Cost840
\[\begin{array}{l} t_1 := x + \frac{z}{\frac{a - t}{y}}\\ \mathbf{if}\;z \leq -2.808868850083143 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{+100}:\\ \;\;\;\;x - y \cdot \frac{t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error8.3
Cost840
\[\begin{array}{l} t_1 := x + z \cdot \frac{y}{a - t}\\ \mathbf{if}\;z \leq -2.808868850083143 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+113}:\\ \;\;\;\;x - y \cdot \frac{t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error1.4
Cost832
\[x + y \cdot \frac{1}{\frac{a - t}{z - t}} \]
Alternative 9
Error1.4
Cost832
\[x + y \cdot \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \]
Alternative 10
Error19.7
Cost712
\[\begin{array}{l} t_1 := x - \frac{y \cdot t}{a}\\ \mathbf{if}\;a \leq -1.0442147176995317 \cdot 10^{+70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 5.261789708635957 \cdot 10^{+137}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error29.7
Cost592
\[\begin{array}{l} \mathbf{if}\;a \leq -5 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -1.8 \cdot 10^{-189}:\\ \;\;\;\;y\\ \mathbf{elif}\;a \leq -3.05 \cdot 10^{-279}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 8.8 \cdot 10^{-265}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error20.3
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -5.8 \cdot 10^{-219}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.5 \cdot 10^{-87}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 13
Error51.2
Cost64
\[y \]

Error

Reproduce

herbie shell --seed 2022300 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
  :precision binary64

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

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