Average Error: 10.9 → 15.7
Time: 10.3s
Precision: binary64
Cost: 1368
\[x + \frac{y \cdot \left(z - t\right)}{z - a} \]
\[\begin{array}{l} t_1 := x - \frac{z - t}{a} \cdot y\\ \mathbf{if}\;a \leq -7.352093512701898 \cdot 10^{+64}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -4.7 \cdot 10^{-194}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq -4.6 \cdot 10^{-245}:\\ \;\;\;\;\frac{y}{\frac{z - a}{z - t}}\\ \mathbf{elif}\;a \leq -2.4 \cdot 10^{-300}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 1.15 \cdot 10^{-239}:\\ \;\;\;\;x - y \cdot \frac{t}{z}\\ \mathbf{elif}\;a \leq 1.3675986399721009 \cdot 10^{+35}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- x (* (/ (- z t) a) y))))
   (if (<= a -7.352093512701898e+64)
     t_1
     (if (<= a -4.7e-194)
       (+ x y)
       (if (<= a -4.6e-245)
         (/ y (/ (- z a) (- z t)))
         (if (<= a -2.4e-300)
           x
           (if (<= a 1.15e-239)
             (- x (* y (/ t z)))
             (if (<= a 1.3675986399721009e+35) (+ x y) t_1))))))))
double code(double x, double y, double z, double t, double a) {
	return x + ((y * (z - t)) / (z - a));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = x - (((z - t) / a) * y);
	double tmp;
	if (a <= -7.352093512701898e+64) {
		tmp = t_1;
	} else if (a <= -4.7e-194) {
		tmp = x + y;
	} else if (a <= -4.6e-245) {
		tmp = y / ((z - a) / (z - t));
	} else if (a <= -2.4e-300) {
		tmp = x;
	} else if (a <= 1.15e-239) {
		tmp = x - (y * (t / z));
	} else if (a <= 1.3675986399721009e+35) {
		tmp = x + y;
	} 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)) / (z - a))
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 - (((z - t) / a) * y)
    if (a <= (-7.352093512701898d+64)) then
        tmp = t_1
    else if (a <= (-4.7d-194)) then
        tmp = x + y
    else if (a <= (-4.6d-245)) then
        tmp = y / ((z - a) / (z - t))
    else if (a <= (-2.4d-300)) then
        tmp = x
    else if (a <= 1.15d-239) then
        tmp = x - (y * (t / z))
    else if (a <= 1.3675986399721009d+35) then
        tmp = x + y
    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)) / (z - a));
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x - (((z - t) / a) * y);
	double tmp;
	if (a <= -7.352093512701898e+64) {
		tmp = t_1;
	} else if (a <= -4.7e-194) {
		tmp = x + y;
	} else if (a <= -4.6e-245) {
		tmp = y / ((z - a) / (z - t));
	} else if (a <= -2.4e-300) {
		tmp = x;
	} else if (a <= 1.15e-239) {
		tmp = x - (y * (t / z));
	} else if (a <= 1.3675986399721009e+35) {
		tmp = x + y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	return x + ((y * (z - t)) / (z - a))
def code(x, y, z, t, a):
	t_1 = x - (((z - t) / a) * y)
	tmp = 0
	if a <= -7.352093512701898e+64:
		tmp = t_1
	elif a <= -4.7e-194:
		tmp = x + y
	elif a <= -4.6e-245:
		tmp = y / ((z - a) / (z - t))
	elif a <= -2.4e-300:
		tmp = x
	elif a <= 1.15e-239:
		tmp = x - (y * (t / z))
	elif a <= 1.3675986399721009e+35:
		tmp = x + y
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a)))
end
function code(x, y, z, t, a)
	t_1 = Float64(x - Float64(Float64(Float64(z - t) / a) * y))
	tmp = 0.0
	if (a <= -7.352093512701898e+64)
		tmp = t_1;
	elseif (a <= -4.7e-194)
		tmp = Float64(x + y);
	elseif (a <= -4.6e-245)
		tmp = Float64(y / Float64(Float64(z - a) / Float64(z - t)));
	elseif (a <= -2.4e-300)
		tmp = x;
	elseif (a <= 1.15e-239)
		tmp = Float64(x - Float64(y * Float64(t / z)));
	elseif (a <= 1.3675986399721009e+35)
		tmp = Float64(x + y);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((y * (z - t)) / (z - a));
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x - (((z - t) / a) * y);
	tmp = 0.0;
	if (a <= -7.352093512701898e+64)
		tmp = t_1;
	elseif (a <= -4.7e-194)
		tmp = x + y;
	elseif (a <= -4.6e-245)
		tmp = y / ((z - a) / (z - t));
	elseif (a <= -2.4e-300)
		tmp = x;
	elseif (a <= 1.15e-239)
		tmp = x - (y * (t / z));
	elseif (a <= 1.3675986399721009e+35)
		tmp = x + y;
	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[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -7.352093512701898e+64], t$95$1, If[LessEqual[a, -4.7e-194], N[(x + y), $MachinePrecision], If[LessEqual[a, -4.6e-245], N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -2.4e-300], x, If[LessEqual[a, 1.15e-239], N[(x - N[(y * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.3675986399721009e+35], N[(x + y), $MachinePrecision], t$95$1]]]]]]]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
t_1 := x - \frac{z - t}{a} \cdot y\\
\mathbf{if}\;a \leq -7.352093512701898 \cdot 10^{+64}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq -4.7 \cdot 10^{-194}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;a \leq -4.6 \cdot 10^{-245}:\\
\;\;\;\;\frac{y}{\frac{z - a}{z - t}}\\

\mathbf{elif}\;a \leq -2.4 \cdot 10^{-300}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 1.15 \cdot 10^{-239}:\\
\;\;\;\;x - y \cdot \frac{t}{z}\\

\mathbf{elif}\;a \leq 1.3675986399721009 \cdot 10^{+35}:\\
\;\;\;\;x + y\\

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.9
Target1.2
Herbie15.7
\[x + \frac{y}{\frac{z - a}{z - t}} \]

Derivation

  1. Split input into 5 regimes
  2. if a < -7.352093512701898e64 or 1.36759863997210088e35 < a

    1. Initial program 12.5

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

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

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

      \[\leadsto \color{blue}{x - \frac{z - t}{a} \cdot y} \]

    if -7.352093512701898e64 < a < -4.7000000000000003e-194 or 1.1499999999999999e-239 < a < 1.36759863997210088e35

    1. Initial program 9.3

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

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

      \[\leadsto \color{blue}{y + x} \]
    4. Simplified18.5

      \[\leadsto \color{blue}{x + y} \]

    if -4.7000000000000003e-194 < a < -4.6000000000000003e-245

    1. Initial program 10.0

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{z}{z - a} - \frac{t}{z - a}\right)} \]
    4. Simplified32.0

      \[\leadsto \color{blue}{y \cdot \frac{z - t}{z - a}} \]
    5. Applied egg-rr31.8

      \[\leadsto \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]

    if -4.6000000000000003e-245 < a < -2.39999999999999999e-300

    1. Initial program 9.9

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

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

      \[\leadsto \color{blue}{x} \]

    if -2.39999999999999999e-300 < a < 1.1499999999999999e-239

    1. Initial program 10.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)} \]
    3. Applied egg-rr2.9

      \[\leadsto \color{blue}{x + \frac{y}{\frac{z - a}{z - t}}} \]
    4. Taylor expanded in a around 0 4.1

      \[\leadsto x + \frac{y}{\color{blue}{\frac{z}{z - t}}} \]
    5. Taylor expanded in z around 0 22.8

      \[\leadsto x + \color{blue}{-1 \cdot \frac{y \cdot t}{z}} \]
    6. Simplified22.9

      \[\leadsto x + \color{blue}{\frac{t}{z} \cdot \left(-y\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification15.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -7.352093512701898 \cdot 10^{+64}:\\ \;\;\;\;x - \frac{z - t}{a} \cdot y\\ \mathbf{elif}\;a \leq -4.7 \cdot 10^{-194}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq -4.6 \cdot 10^{-245}:\\ \;\;\;\;\frac{y}{\frac{z - a}{z - t}}\\ \mathbf{elif}\;a \leq -2.4 \cdot 10^{-300}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 1.15 \cdot 10^{-239}:\\ \;\;\;\;x - y \cdot \frac{t}{z}\\ \mathbf{elif}\;a \leq 1.3675986399721009 \cdot 10^{+35}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z - t}{a} \cdot y\\ \end{array} \]

Alternatives

Alternative 1
Error22.8
Cost1372
\[\begin{array}{l} t_1 := y \cdot \frac{t - z}{a}\\ \mathbf{if}\;x \leq -3.4996900664560357 \cdot 10^{-152}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq -8.38326387334517 \cdot 10^{-215}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.2458026484204553 \cdot 10^{-237}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq -1.1342731104143966 \cdot 10^{-254}:\\ \;\;\;\;y \cdot \frac{t}{-z}\\ \mathbf{elif}\;x \leq -1.2339209565718572 \cdot 10^{-287}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.263793430675803 \cdot 10^{-286}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 3.2804018435109405 \cdot 10^{-235}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 2
Error17.8
Cost1240
\[\begin{array}{l} t_1 := x + \frac{y}{\frac{a}{t}}\\ \mathbf{if}\;a \leq -3.440354216829813 \cdot 10^{+94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -4.7 \cdot 10^{-194}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq -4.6 \cdot 10^{-245}:\\ \;\;\;\;\frac{y}{\frac{z}{z - t}}\\ \mathbf{elif}\;a \leq -2.4 \cdot 10^{-300}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 1.15 \cdot 10^{-239}:\\ \;\;\;\;x - y \cdot \frac{t}{z}\\ \mathbf{elif}\;a \leq 1.3675986399721009 \cdot 10^{+35}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error16.7
Cost1240
\[\begin{array}{l} t_1 := x + \frac{y}{\frac{a}{t}}\\ \mathbf{if}\;a \leq -3.440354216829813 \cdot 10^{+94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -4.7 \cdot 10^{-194}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq -4.2 \cdot 10^{-209}:\\ \;\;\;\;y \cdot \frac{-t}{z - a}\\ \mathbf{elif}\;a \leq -2.4 \cdot 10^{-300}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq 1.15 \cdot 10^{-239}:\\ \;\;\;\;x - y \cdot \frac{t}{z}\\ \mathbf{elif}\;a \leq 1.3675986399721009 \cdot 10^{+35}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error15.4
Cost1236
\[\begin{array}{l} t_1 := \frac{y}{\frac{z - a}{z - t}}\\ \mathbf{if}\;z \leq -1.8644346894045836 \cdot 10^{+95}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -26253.584081986362:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 10694994263919630:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{elif}\;z \leq 5.725129025365141 \cdot 10^{+152}:\\ \;\;\;\;x - y \cdot \frac{t}{z}\\ \mathbf{elif}\;z \leq 4.449556251573296 \cdot 10^{+166}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 5
Error22.0
Cost976
\[\begin{array}{l} t_1 := y \cdot \frac{t - z}{a}\\ \mathbf{if}\;x \leq -3.4996900664560357 \cdot 10^{-152}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq -1.450378323631937 \cdot 10^{-218}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.263793430675803 \cdot 10^{-286}:\\ \;\;\;\;\frac{y}{\frac{z}{z - t}}\\ \mathbf{elif}\;x \leq 3.2804018435109405 \cdot 10^{-235}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 6
Error14.2
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -3.302919194384396 \cdot 10^{-44}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3.555318880041199 \cdot 10^{-94}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 7
Error27.1
Cost592
\[\begin{array}{l} \mathbf{if}\;x \leq -8.8952717139431 \cdot 10^{-228}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.992099380437719 \cdot 10^{-252}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq 4.868691035507561 \cdot 10^{-42}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.946228257494404 \cdot 10^{-30}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error19.2
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -5.656673676119437 \cdot 10^{-65}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 30202.516212601757:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 9
Error28.5
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, A"
  :precision binary64

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

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