Average Error: 11.1 → 9.1
Time: 6.9s
Precision: binary64
Cost: 840
\[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
\[\begin{array}{l} t_1 := x - \left(\frac{y}{t} \cdot z - y\right)\\ \mathbf{if}\;t \leq -2.879630404786511 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.224956389148705 \cdot 10^{+134}:\\ \;\;\;\;x + y \cdot \frac{z}{a - t}\\ \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 (- (* (/ y t) z) y))))
   (if (<= t -2.879630404786511e+44)
     t_1
     (if (<= t 2.224956389148705e+134) (+ x (* y (/ z (- a t)))) 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 - (((y / t) * z) - y);
	double tmp;
	if (t <= -2.879630404786511e+44) {
		tmp = t_1;
	} else if (t <= 2.224956389148705e+134) {
		tmp = x + (y * (z / (a - t)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    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
    code = x + ((y * (z - t)) / (a - t))
end function
real(8) function code(x, y, z, t, a)
    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) :: t_1
    real(8) :: tmp
    t_1 = x - (((y / t) * z) - y)
    if (t <= (-2.879630404786511d+44)) then
        tmp = t_1
    else if (t <= 2.224956389148705d+134) then
        tmp = x + (y * (z / (a - t)))
    else
        tmp = t_1
    end if
    code = tmp
end function
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 - (((y / t) * z) - y);
	double tmp;
	if (t <= -2.879630404786511e+44) {
		tmp = t_1;
	} else if (t <= 2.224956389148705e+134) {
		tmp = x + (y * (z / (a - t)));
	} 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 - (((y / t) * z) - y)
	tmp = 0
	if t <= -2.879630404786511e+44:
		tmp = t_1
	elif t <= 2.224956389148705e+134:
		tmp = x + (y * (z / (a - t)))
	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(Float64(y / t) * z) - y))
	tmp = 0.0
	if (t <= -2.879630404786511e+44)
		tmp = t_1;
	elseif (t <= 2.224956389148705e+134)
		tmp = Float64(x + Float64(y * Float64(z / Float64(a - t))));
	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 - (((y / t) * z) - y);
	tmp = 0.0;
	if (t <= -2.879630404786511e+44)
		tmp = t_1;
	elseif (t <= 2.224956389148705e+134)
		tmp = x + (y * (z / (a - t)));
	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[(N[(y / t), $MachinePrecision] * z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.879630404786511e+44], t$95$1, If[LessEqual[t, 2.224956389148705e+134], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
t_1 := x - \left(\frac{y}{t} \cdot z - y\right)\\
\mathbf{if}\;t \leq -2.879630404786511 \cdot 10^{+44}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 2.224956389148705 \cdot 10^{+134}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\

\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
Herbie9.1
\[x + \frac{y}{\frac{a - t}{z - t}} \]

Derivation

  1. Split input into 2 regimes
  2. if t < -2.8796304047865109e44 or 2.22495638914870484e134 < t

    1. Initial program 20.9

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

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

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

    if -2.8796304047865109e44 < t < 2.22495638914870484e134

    1. Initial program 4.8

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a - t}} \]
    3. Simplified9.9

      \[\leadsto x + \color{blue}{\frac{z}{\frac{a - t}{y}}} \]
    4. Applied egg-rr10.4

      \[\leadsto x + \color{blue}{y \cdot \frac{z}{a - t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.1

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

Alternatives

Alternative 1
Error10.4
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -2.879630404786511 \cdot 10^{+44}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.224956389148705 \cdot 10^{+134}:\\ \;\;\;\;x + y \cdot \frac{z}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 2
Error20.8
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -1.1118295751400003 \cdot 10^{-9}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq -5.5015329556195954 \cdot 10^{-96}:\\ \;\;\;\;\frac{z}{\frac{a - t}{y}}\\ \mathbf{elif}\;t \leq 1.350961328727771 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 3
Error14.5
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -2871975491.741219:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.350961328727771 \cdot 10^{-110}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 4
Error20.3
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-205}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.350961328727771 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 5
Error28.6
Cost64
\[x \]

Error

Reproduce

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