Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B

Percentage Accurate: 95.8% → 99.7%
Time: 8.3s
Alternatives: 8
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \frac{x}{y - z \cdot t} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
def code(x, y, z, t):
	return x / (y - (z * t))
function code(x, y, z, t)
	return Float64(x / Float64(y - Float64(z * t)))
end
function tmp = code(x, y, z, t)
	tmp = x / (y - (z * t));
end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{y - z \cdot t}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 95.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x}{y - z \cdot t} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
	return x / (y - (z * t));
}
def code(x, y, z, t):
	return x / (y - (z * t))
function code(x, y, z, t)
	return Float64(x / Float64(y - Float64(z * t)))
end
function tmp = code(x, y, z, t)
	tmp = x / (y - (z * t));
end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{y - z \cdot t}
\end{array}

Alternative 1: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+243}\right):\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\ \end{array} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 5e+243)))
   (* (/ -1.0 z) (/ x t))
   (/ x (fma z (- t) y))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -((double) INFINITY)) || !((z * t) <= 5e+243)) {
		tmp = (-1.0 / z) * (x / t);
	} else {
		tmp = x / fma(z, -t, y);
	}
	return tmp;
}
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(z * t) <= Float64(-Inf)) || !(Float64(z * t) <= 5e+243))
		tmp = Float64(Float64(-1.0 / z) * Float64(x / t));
	else
		tmp = Float64(x / fma(z, Float64(-t), y));
	end
	return tmp
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e+243]], $MachinePrecision]], N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z * (-t) + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+243}\right):\\
\;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -inf.0 or 5.00000000000000037e243 < (*.f64 z t)

    1. Initial program 72.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg72.0%

        \[\leadsto \frac{x}{\color{blue}{y + \left(-z \cdot t\right)}} \]
      2. +-commutative72.0%

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right) + y}} \]
      3. distribute-rgt-neg-in72.0%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      4. fma-udef72.0%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
      5. clear-num72.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(z, -t, y\right)}{x}}} \]
      6. inv-pow72.0%

        \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, -t, y\right)}{x}\right)}^{-1}} \]
      7. add-sqr-sqrt41.6%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}, y\right)}{x}\right)}^{-1} \]
      8. sqrt-unprod72.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}, y\right)}{x}\right)}^{-1} \]
      9. sqr-neg72.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \sqrt{\color{blue}{t \cdot t}}, y\right)}{x}\right)}^{-1} \]
      10. sqrt-unprod30.4%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}, y\right)}{x}\right)}^{-1} \]
      11. add-sqr-sqrt67.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{t}, y\right)}{x}\right)}^{-1} \]
    3. Applied egg-rr67.0%

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, t, y\right)}{x}\right)}^{-1}} \]
    4. Taylor expanded in z around inf 67.0%

      \[\leadsto \color{blue}{\frac{x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt33.2%

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{t \cdot z} \]
      2. sqrt-unprod68.2%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x}}}{t \cdot z} \]
      3. sqr-neg68.2%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{t \cdot z} \]
      4. sqrt-unprod36.3%

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{t \cdot z} \]
      5. add-sqr-sqrt72.0%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
      6. neg-mul-172.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      7. *-commutative72.0%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      8. times-frac99.9%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr99.9%

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

    if -inf.0 < (*.f64 z t) < 5.00000000000000037e243

    1. Initial program 99.8%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv99.8%

        \[\leadsto \frac{x}{\color{blue}{y + \left(-z\right) \cdot t}} \]
      2. +-commutative99.8%

        \[\leadsto \frac{x}{\color{blue}{\left(-z\right) \cdot t + y}} \]
      3. distribute-lft-neg-out99.8%

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right)} + y} \]
      4. distribute-rgt-neg-out99.8%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      5. fma-def99.8%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(z, -t, y\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+243}\right):\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\ \end{array} \]

Alternative 2: 77.9% accurate, 0.3× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := \frac{-x}{z \cdot t}\\ t_2 := \frac{-1}{z} \cdot \frac{x}{t}\\ \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+89}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+243}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (- x) (* z t))) (t_2 (* (/ -1.0 z) (/ x t))))
   (if (<= (* z t) -5e+89)
     t_2
     (if (<= (* z t) -5e+15)
       (/ x y)
       (if (<= (* z t) -5e-133)
         t_1
         (if (<= (* z t) 4e-17) (/ x y) (if (<= (* z t) 5e+243) t_1 t_2)))))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double t_1 = -x / (z * t);
	double t_2 = (-1.0 / z) * (x / t);
	double tmp;
	if ((z * t) <= -5e+89) {
		tmp = t_2;
	} else if ((z * t) <= -5e+15) {
		tmp = x / y;
	} else if ((z * t) <= -5e-133) {
		tmp = t_1;
	} else if ((z * t) <= 4e-17) {
		tmp = x / y;
	} else if ((z * t) <= 5e+243) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = -x / (z * t)
    t_2 = ((-1.0d0) / z) * (x / t)
    if ((z * t) <= (-5d+89)) then
        tmp = t_2
    else if ((z * t) <= (-5d+15)) then
        tmp = x / y
    else if ((z * t) <= (-5d-133)) then
        tmp = t_1
    else if ((z * t) <= 4d-17) then
        tmp = x / y
    else if ((z * t) <= 5d+243) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = -x / (z * t);
	double t_2 = (-1.0 / z) * (x / t);
	double tmp;
	if ((z * t) <= -5e+89) {
		tmp = t_2;
	} else if ((z * t) <= -5e+15) {
		tmp = x / y;
	} else if ((z * t) <= -5e-133) {
		tmp = t_1;
	} else if ((z * t) <= 4e-17) {
		tmp = x / y;
	} else if ((z * t) <= 5e+243) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	t_1 = -x / (z * t)
	t_2 = (-1.0 / z) * (x / t)
	tmp = 0
	if (z * t) <= -5e+89:
		tmp = t_2
	elif (z * t) <= -5e+15:
		tmp = x / y
	elif (z * t) <= -5e-133:
		tmp = t_1
	elif (z * t) <= 4e-17:
		tmp = x / y
	elif (z * t) <= 5e+243:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	t_1 = Float64(Float64(-x) / Float64(z * t))
	t_2 = Float64(Float64(-1.0 / z) * Float64(x / t))
	tmp = 0.0
	if (Float64(z * t) <= -5e+89)
		tmp = t_2;
	elseif (Float64(z * t) <= -5e+15)
		tmp = Float64(x / y);
	elseif (Float64(z * t) <= -5e-133)
		tmp = t_1;
	elseif (Float64(z * t) <= 4e-17)
		tmp = Float64(x / y);
	elseif (Float64(z * t) <= 5e+243)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = -x / (z * t);
	t_2 = (-1.0 / z) * (x / t);
	tmp = 0.0;
	if ((z * t) <= -5e+89)
		tmp = t_2;
	elseif ((z * t) <= -5e+15)
		tmp = x / y;
	elseif ((z * t) <= -5e-133)
		tmp = t_1;
	elseif ((z * t) <= 4e-17)
		tmp = x / y;
	elseif ((z * t) <= 5e+243)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+89], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -5e+15], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-133], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 4e-17], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+243], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{-x}{z \cdot t}\\
t_2 := \frac{-1}{z} \cdot \frac{x}{t}\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+89}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-133}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+243}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -4.99999999999999983e89 or 5.00000000000000037e243 < (*.f64 z t)

    1. Initial program 86.6%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg86.6%

        \[\leadsto \frac{x}{\color{blue}{y + \left(-z \cdot t\right)}} \]
      2. +-commutative86.6%

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right) + y}} \]
      3. distribute-rgt-neg-in86.6%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      4. fma-udef86.6%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
      5. clear-num84.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(z, -t, y\right)}{x}}} \]
      6. inv-pow84.9%

        \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, -t, y\right)}{x}\right)}^{-1}} \]
      7. add-sqr-sqrt51.5%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}, y\right)}{x}\right)}^{-1} \]
      8. sqrt-unprod64.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}, y\right)}{x}\right)}^{-1} \]
      9. sqr-neg64.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \sqrt{\color{blue}{t \cdot t}}, y\right)}{x}\right)}^{-1} \]
      10. sqrt-unprod23.3%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}, y\right)}{x}\right)}^{-1} \]
      11. add-sqr-sqrt50.8%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{t}, y\right)}{x}\right)}^{-1} \]
    3. Applied egg-rr50.8%

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, t, y\right)}{x}\right)}^{-1}} \]
    4. Taylor expanded in z around inf 44.1%

      \[\leadsto \color{blue}{\frac{x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt21.4%

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{t \cdot z} \]
      2. sqrt-unprod54.8%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x}}}{t \cdot z} \]
      3. sqr-neg54.8%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{t \cdot z} \]
      4. sqrt-unprod40.6%

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{t \cdot z} \]
      5. add-sqr-sqrt79.5%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
      6. neg-mul-179.5%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      7. *-commutative79.5%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      8. times-frac90.4%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr90.4%

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

    if -4.99999999999999983e89 < (*.f64 z t) < -5e15 or -4.9999999999999999e-133 < (*.f64 z t) < 4.00000000000000029e-17

    1. Initial program 100.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 86.6%

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

    if -5e15 < (*.f64 z t) < -4.9999999999999999e-133 or 4.00000000000000029e-17 < (*.f64 z t) < 5.00000000000000037e243

    1. Initial program 99.6%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 75.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    3. Step-by-step derivation
      1. associate-*r/75.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
      2. neg-mul-175.8%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    4. Simplified75.8%

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+89}:\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-133}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+243}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \end{array} \]

Alternative 3: 77.9% accurate, 0.3× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := \frac{-x}{z \cdot t}\\ t_2 := \frac{-\frac{x}{t}}{z}\\ \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+89}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+243}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (- x) (* z t))) (t_2 (/ (- (/ x t)) z)))
   (if (<= (* z t) -5e+89)
     t_2
     (if (<= (* z t) -5e+15)
       (/ x y)
       (if (<= (* z t) -5e-133)
         t_1
         (if (<= (* z t) 4e-17) (/ x y) (if (<= (* z t) 5e+243) t_1 t_2)))))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double t_1 = -x / (z * t);
	double t_2 = -(x / t) / z;
	double tmp;
	if ((z * t) <= -5e+89) {
		tmp = t_2;
	} else if ((z * t) <= -5e+15) {
		tmp = x / y;
	} else if ((z * t) <= -5e-133) {
		tmp = t_1;
	} else if ((z * t) <= 4e-17) {
		tmp = x / y;
	} else if ((z * t) <= 5e+243) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = -x / (z * t)
    t_2 = -(x / t) / z
    if ((z * t) <= (-5d+89)) then
        tmp = t_2
    else if ((z * t) <= (-5d+15)) then
        tmp = x / y
    else if ((z * t) <= (-5d-133)) then
        tmp = t_1
    else if ((z * t) <= 4d-17) then
        tmp = x / y
    else if ((z * t) <= 5d+243) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = -x / (z * t);
	double t_2 = -(x / t) / z;
	double tmp;
	if ((z * t) <= -5e+89) {
		tmp = t_2;
	} else if ((z * t) <= -5e+15) {
		tmp = x / y;
	} else if ((z * t) <= -5e-133) {
		tmp = t_1;
	} else if ((z * t) <= 4e-17) {
		tmp = x / y;
	} else if ((z * t) <= 5e+243) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	t_1 = -x / (z * t)
	t_2 = -(x / t) / z
	tmp = 0
	if (z * t) <= -5e+89:
		tmp = t_2
	elif (z * t) <= -5e+15:
		tmp = x / y
	elif (z * t) <= -5e-133:
		tmp = t_1
	elif (z * t) <= 4e-17:
		tmp = x / y
	elif (z * t) <= 5e+243:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	t_1 = Float64(Float64(-x) / Float64(z * t))
	t_2 = Float64(Float64(-Float64(x / t)) / z)
	tmp = 0.0
	if (Float64(z * t) <= -5e+89)
		tmp = t_2;
	elseif (Float64(z * t) <= -5e+15)
		tmp = Float64(x / y);
	elseif (Float64(z * t) <= -5e-133)
		tmp = t_1;
	elseif (Float64(z * t) <= 4e-17)
		tmp = Float64(x / y);
	elseif (Float64(z * t) <= 5e+243)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = -x / (z * t);
	t_2 = -(x / t) / z;
	tmp = 0.0;
	if ((z * t) <= -5e+89)
		tmp = t_2;
	elseif ((z * t) <= -5e+15)
		tmp = x / y;
	elseif ((z * t) <= -5e-133)
		tmp = t_1;
	elseif ((z * t) <= 4e-17)
		tmp = x / y;
	elseif ((z * t) <= 5e+243)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[(x / t), $MachinePrecision]) / z), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+89], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -5e+15], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-133], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 4e-17], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+243], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{-x}{z \cdot t}\\
t_2 := \frac{-\frac{x}{t}}{z}\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+89}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-133}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+243}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -4.99999999999999983e89 or 5.00000000000000037e243 < (*.f64 z t)

    1. Initial program 86.6%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg86.6%

        \[\leadsto \frac{x}{\color{blue}{y + \left(-z \cdot t\right)}} \]
      2. +-commutative86.6%

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right) + y}} \]
      3. distribute-rgt-neg-in86.6%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      4. fma-udef86.6%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
      5. frac-2neg86.6%

        \[\leadsto \color{blue}{\frac{-x}{-\mathsf{fma}\left(z, -t, y\right)}} \]
      6. div-inv86.6%

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{1}{-\mathsf{fma}\left(z, -t, y\right)}} \]
      7. fma-udef86.6%

        \[\leadsto \left(-x\right) \cdot \frac{1}{-\color{blue}{\left(z \cdot \left(-t\right) + y\right)}} \]
      8. distribute-rgt-neg-in86.6%

        \[\leadsto \left(-x\right) \cdot \frac{1}{-\left(\color{blue}{\left(-z \cdot t\right)} + y\right)} \]
      9. distribute-neg-in86.6%

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

      \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{1}{z \cdot t - y}} \]
    4. Step-by-step derivation
      1. /-rgt-identity86.6%

        \[\leadsto \left(-x\right) \cdot \frac{1}{\color{blue}{\frac{z \cdot t - y}{1}}} \]
      2. add-cube-cbrt86.1%

        \[\leadsto \left(-x\right) \cdot \frac{1}{\frac{\color{blue}{\left(\sqrt[3]{z \cdot t - y} \cdot \sqrt[3]{z \cdot t - y}\right) \cdot \sqrt[3]{z \cdot t - y}}}{1}} \]
      3. associate-/l*86.0%

        \[\leadsto \left(-x\right) \cdot \frac{1}{\color{blue}{\frac{\sqrt[3]{z \cdot t - y} \cdot \sqrt[3]{z \cdot t - y}}{\frac{1}{\sqrt[3]{z \cdot t - y}}}}} \]
      4. pow286.0%

        \[\leadsto \left(-x\right) \cdot \frac{1}{\frac{\color{blue}{{\left(\sqrt[3]{z \cdot t - y}\right)}^{2}}}{\frac{1}{\sqrt[3]{z \cdot t - y}}}} \]
    5. Applied egg-rr86.0%

      \[\leadsto \left(-x\right) \cdot \frac{1}{\color{blue}{\frac{{\left(\sqrt[3]{z \cdot t - y}\right)}^{2}}{\frac{1}{\sqrt[3]{z \cdot t - y}}}}} \]
    6. Taylor expanded in z around inf 79.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    7. Step-by-step derivation
      1. mul-1-neg79.5%

        \[\leadsto \color{blue}{-\frac{x}{t \cdot z}} \]
      2. associate-/r*90.4%

        \[\leadsto -\color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. distribute-neg-frac90.4%

        \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
    8. Simplified90.4%

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

    if -4.99999999999999983e89 < (*.f64 z t) < -5e15 or -4.9999999999999999e-133 < (*.f64 z t) < 4.00000000000000029e-17

    1. Initial program 100.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 86.6%

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

    if -5e15 < (*.f64 z t) < -4.9999999999999999e-133 or 4.00000000000000029e-17 < (*.f64 z t) < 5.00000000000000037e243

    1. Initial program 99.6%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 75.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    3. Step-by-step derivation
      1. associate-*r/75.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
      2. neg-mul-175.8%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    4. Simplified75.8%

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+89}:\\ \;\;\;\;\frac{-\frac{x}{t}}{z}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-133}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+243}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\frac{x}{t}}{z}\\ \end{array} \]

Alternative 4: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+243}\right):\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \end{array} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 5e+243)))
   (* (/ -1.0 z) (/ x t))
   (/ x (- y (* z t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -((double) INFINITY)) || !((z * t) <= 5e+243)) {
		tmp = (-1.0 / z) * (x / t);
	} else {
		tmp = x / (y - (z * t));
	}
	return tmp;
}
assert z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((z * t) <= -Double.POSITIVE_INFINITY) || !((z * t) <= 5e+243)) {
		tmp = (-1.0 / z) * (x / t);
	} else {
		tmp = x / (y - (z * t));
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if ((z * t) <= -math.inf) or not ((z * t) <= 5e+243):
		tmp = (-1.0 / z) * (x / t)
	else:
		tmp = x / (y - (z * t))
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(z * t) <= Float64(-Inf)) || !(Float64(z * t) <= 5e+243))
		tmp = Float64(Float64(-1.0 / z) * Float64(x / t));
	else
		tmp = Float64(x / Float64(y - Float64(z * t)));
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((z * t) <= -Inf) || ~(((z * t) <= 5e+243)))
		tmp = (-1.0 / z) * (x / t);
	else
		tmp = x / (y - (z * t));
	end
	tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e+243]], $MachinePrecision]], N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+243}\right):\\
\;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -inf.0 or 5.00000000000000037e243 < (*.f64 z t)

    1. Initial program 72.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg72.0%

        \[\leadsto \frac{x}{\color{blue}{y + \left(-z \cdot t\right)}} \]
      2. +-commutative72.0%

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right) + y}} \]
      3. distribute-rgt-neg-in72.0%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      4. fma-udef72.0%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
      5. clear-num72.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(z, -t, y\right)}{x}}} \]
      6. inv-pow72.0%

        \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, -t, y\right)}{x}\right)}^{-1}} \]
      7. add-sqr-sqrt41.6%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}, y\right)}{x}\right)}^{-1} \]
      8. sqrt-unprod72.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}, y\right)}{x}\right)}^{-1} \]
      9. sqr-neg72.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \sqrt{\color{blue}{t \cdot t}}, y\right)}{x}\right)}^{-1} \]
      10. sqrt-unprod30.4%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}, y\right)}{x}\right)}^{-1} \]
      11. add-sqr-sqrt67.0%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{t}, y\right)}{x}\right)}^{-1} \]
    3. Applied egg-rr67.0%

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, t, y\right)}{x}\right)}^{-1}} \]
    4. Taylor expanded in z around inf 67.0%

      \[\leadsto \color{blue}{\frac{x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt33.2%

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{t \cdot z} \]
      2. sqrt-unprod68.2%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x}}}{t \cdot z} \]
      3. sqr-neg68.2%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{t \cdot z} \]
      4. sqrt-unprod36.3%

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{t \cdot z} \]
      5. add-sqr-sqrt72.0%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
      6. neg-mul-172.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      7. *-commutative72.0%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      8. times-frac99.9%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr99.9%

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

    if -inf.0 < (*.f64 z t) < 5.00000000000000037e243

    1. Initial program 99.8%

      \[\frac{x}{y - z \cdot t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.8%

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

Alternative 5: 73.2% accurate, 0.7× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+32}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-72}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.5e+32) (/ x y) (if (<= y 4.8e-72) (/ (- x) (* z t)) (/ x y))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.5e+32) {
		tmp = x / y;
	} else if (y <= 4.8e-72) {
		tmp = -x / (z * t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= (-1.5d+32)) then
        tmp = x / y
    else if (y <= 4.8d-72) then
        tmp = -x / (z * t)
    else
        tmp = x / y
    end if
    code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.5e+32) {
		tmp = x / y;
	} else if (y <= 4.8e-72) {
		tmp = -x / (z * t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -1.5e+32:
		tmp = x / y
	elif y <= 4.8e-72:
		tmp = -x / (z * t)
	else:
		tmp = x / y
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.5e+32)
		tmp = Float64(x / y);
	elseif (y <= 4.8e-72)
		tmp = Float64(Float64(-x) / Float64(z * t));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.5e+32)
		tmp = x / y;
	elseif (y <= 4.8e-72)
		tmp = -x / (z * t);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[y, -1.5e+32], N[(x / y), $MachinePrecision], If[LessEqual[y, 4.8e-72], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{-72}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.5e32 or 4.8e-72 < y

    1. Initial program 95.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 76.7%

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

    if -1.5e32 < y < 4.8e-72

    1. Initial program 95.7%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 83.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    3. Step-by-step derivation
      1. associate-*r/83.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
      2. neg-mul-183.0%

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    4. Simplified83.0%

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+32}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-72}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 6: 58.7% accurate, 0.8× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -2100000000 \lor \neg \left(t \leq 6.8 \cdot 10^{+181}\right):\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -2100000000.0) (not (<= t 6.8e+181))) (/ x (* z t)) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2100000000.0) || !(t <= 6.8e+181)) {
		tmp = x / (z * t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((t <= (-2100000000.0d0)) .or. (.not. (t <= 6.8d+181))) then
        tmp = x / (z * t)
    else
        tmp = x / y
    end if
    code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2100000000.0) || !(t <= 6.8e+181)) {
		tmp = x / (z * t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if (t <= -2100000000.0) or not (t <= 6.8e+181):
		tmp = x / (z * t)
	else:
		tmp = x / y
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -2100000000.0) || !(t <= 6.8e+181))
		tmp = Float64(x / Float64(z * t));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -2100000000.0) || ~((t <= 6.8e+181)))
		tmp = x / (z * t);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2100000000.0], N[Not[LessEqual[t, 6.8e+181]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2100000000 \lor \neg \left(t \leq 6.8 \cdot 10^{+181}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.1e9 or 6.80000000000000062e181 < t

    1. Initial program 91.3%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg91.3%

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

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right) + y}} \]
      3. distribute-rgt-neg-in91.3%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      4. fma-udef91.3%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
      5. clear-num88.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(z, -t, y\right)}{x}}} \]
      6. inv-pow88.6%

        \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, -t, y\right)}{x}\right)}^{-1}} \]
      7. add-sqr-sqrt65.4%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}, y\right)}{x}\right)}^{-1} \]
      8. sqrt-unprod57.2%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}, y\right)}{x}\right)}^{-1} \]
      9. sqr-neg57.2%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \sqrt{\color{blue}{t \cdot t}}, y\right)}{x}\right)}^{-1} \]
      10. sqrt-unprod14.3%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}, y\right)}{x}\right)}^{-1} \]
      11. add-sqr-sqrt50.9%

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

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, t, y\right)}{x}\right)}^{-1}} \]
    4. Taylor expanded in z around inf 32.3%

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

    if -2.1e9 < t < 6.80000000000000062e181

    1. Initial program 98.7%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 61.4%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2100000000 \lor \neg \left(t \leq 6.8 \cdot 10^{+181}\right):\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 7: 58.8% accurate, 0.8× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{x}{z}}{t}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+80}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \end{array} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= z -2.8e+140) (/ (/ x z) t) (if (<= z 5.2e+80) (/ x y) (/ x (* z t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -2.8e+140) {
		tmp = (x / z) / t;
	} else if (z <= 5.2e+80) {
		tmp = x / y;
	} else {
		tmp = x / (z * t);
	}
	return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-2.8d+140)) then
        tmp = (x / z) / t
    else if (z <= 5.2d+80) then
        tmp = x / y
    else
        tmp = x / (z * t)
    end if
    code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -2.8e+140) {
		tmp = (x / z) / t;
	} else if (z <= 5.2e+80) {
		tmp = x / y;
	} else {
		tmp = x / (z * t);
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if z <= -2.8e+140:
		tmp = (x / z) / t
	elif z <= 5.2e+80:
		tmp = x / y
	else:
		tmp = x / (z * t)
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -2.8e+140)
		tmp = Float64(Float64(x / z) / t);
	elseif (z <= 5.2e+80)
		tmp = Float64(x / y);
	else
		tmp = Float64(x / Float64(z * t));
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -2.8e+140)
		tmp = (x / z) / t;
	elseif (z <= 5.2e+80)
		tmp = x / y;
	else
		tmp = x / (z * t);
	end
	tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+140], N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 5.2e+80], N[(x / y), $MachinePrecision], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+140}:\\
\;\;\;\;\frac{\frac{x}{z}}{t}\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{+80}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.79999999999999983e140

    1. Initial program 94.5%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg94.5%

        \[\leadsto \frac{x}{\color{blue}{y + \left(-z \cdot t\right)}} \]
      2. +-commutative94.5%

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right) + y}} \]
      3. distribute-rgt-neg-in94.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      4. fma-udef94.5%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
      5. frac-2neg94.5%

        \[\leadsto \color{blue}{\frac{-x}{-\mathsf{fma}\left(z, -t, y\right)}} \]
      6. div-inv94.3%

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{1}{-\mathsf{fma}\left(z, -t, y\right)}} \]
      7. fma-udef94.3%

        \[\leadsto \left(-x\right) \cdot \frac{1}{-\color{blue}{\left(z \cdot \left(-t\right) + y\right)}} \]
      8. distribute-rgt-neg-in94.3%

        \[\leadsto \left(-x\right) \cdot \frac{1}{-\left(\color{blue}{\left(-z \cdot t\right)} + y\right)} \]
      9. distribute-neg-in94.3%

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

      \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{1}{z \cdot t - y}} \]
    4. Step-by-step derivation
      1. un-div-inv94.5%

        \[\leadsto \color{blue}{\frac{-x}{z \cdot t - y}} \]
      2. sub-neg94.5%

        \[\leadsto \frac{-x}{\color{blue}{z \cdot t + \left(-y\right)}} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto \frac{-x}{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot t + \left(-y\right)} \]
      4. add-sqr-sqrt0.0%

        \[\leadsto \frac{-x}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \color{blue}{\left(\sqrt{t} \cdot \sqrt{t}\right)} + \left(-y\right)} \]
      5. sqrt-unprod25.8%

        \[\leadsto \frac{-x}{\color{blue}{\sqrt{z \cdot z}} \cdot \left(\sqrt{t} \cdot \sqrt{t}\right) + \left(-y\right)} \]
      6. sqr-neg25.8%

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

        \[\leadsto \frac{-x}{\color{blue}{\left(\sqrt{-z} \cdot \sqrt{-z}\right)} \cdot \left(\sqrt{t} \cdot \sqrt{t}\right) + \left(-y\right)} \]
      8. add-sqr-sqrt31.1%

        \[\leadsto \frac{-x}{\color{blue}{\left(-z\right)} \cdot \left(\sqrt{t} \cdot \sqrt{t}\right) + \left(-y\right)} \]
      9. associate-*l*31.1%

        \[\leadsto \frac{-x}{\color{blue}{\left(\left(-z\right) \cdot \sqrt{t}\right) \cdot \sqrt{t}} + \left(-y\right)} \]
      10. distribute-lft-neg-out31.1%

        \[\leadsto \frac{-x}{\color{blue}{\left(-z \cdot \sqrt{t}\right)} \cdot \sqrt{t} + \left(-y\right)} \]
      11. distribute-lft-neg-out31.1%

        \[\leadsto \frac{-x}{\color{blue}{\left(-\left(z \cdot \sqrt{t}\right) \cdot \sqrt{t}\right)} + \left(-y\right)} \]
      12. associate-*r*31.1%

        \[\leadsto \frac{-x}{\left(-\color{blue}{z \cdot \left(\sqrt{t} \cdot \sqrt{t}\right)}\right) + \left(-y\right)} \]
      13. add-sqr-sqrt69.1%

        \[\leadsto \frac{-x}{\left(-z \cdot \color{blue}{t}\right) + \left(-y\right)} \]
      14. distribute-neg-in69.1%

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

        \[\leadsto \frac{-x}{-\color{blue}{\mathsf{fma}\left(z, t, y\right)}} \]
      16. frac-2neg69.1%

        \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(z, t, y\right)}} \]
      17. clear-num69.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(z, t, y\right)}{x}}} \]
      18. frac-2neg69.2%

        \[\leadsto \color{blue}{\frac{-1}{-\frac{\mathsf{fma}\left(z, t, y\right)}{x}}} \]
      19. metadata-eval69.2%

        \[\leadsto \frac{\color{blue}{-1}}{-\frac{\mathsf{fma}\left(z, t, y\right)}{x}} \]
      20. add-sqr-sqrt31.8%

        \[\leadsto \frac{-1}{-\frac{\mathsf{fma}\left(z, t, y\right)}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}} \]
      21. sqrt-unprod74.2%

        \[\leadsto \frac{-1}{-\frac{\mathsf{fma}\left(z, t, y\right)}{\color{blue}{\sqrt{x \cdot x}}}} \]
    5. Applied egg-rr82.6%

      \[\leadsto \color{blue}{\frac{-1}{\frac{\mathsf{fma}\left(z, t, y\right)}{x}}} \]
    6. Taylor expanded in z around inf 80.1%

      \[\leadsto \frac{-1}{\color{blue}{\frac{t \cdot z}{x}}} \]
    7. Step-by-step derivation
      1. associate-/l*88.2%

        \[\leadsto \frac{-1}{\color{blue}{\frac{t}{\frac{x}{z}}}} \]
      2. associate-/r/80.6%

        \[\leadsto \frac{-1}{\color{blue}{\frac{t}{x} \cdot z}} \]
    8. Simplified80.6%

      \[\leadsto \frac{-1}{\color{blue}{\frac{t}{x} \cdot z}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u76.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-1}{\frac{t}{x} \cdot z}\right)\right)} \]
      2. expm1-udef58.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-1}{\frac{t}{x} \cdot z}\right)} - 1} \]
      3. associate-/r*58.2%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{-1}{\frac{t}{x}}}{z}}\right)} - 1 \]
      4. frac-2neg58.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{--1}{-\frac{t}{x}}}}{z}\right)} - 1 \]
      5. metadata-eval58.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{\color{blue}{1}}{-\frac{t}{x}}}{z}\right)} - 1 \]
      6. add-sqr-sqrt23.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{-\frac{t}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z}\right)} - 1 \]
      7. sqrt-unprod57.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{-\frac{t}{\color{blue}{\sqrt{x \cdot x}}}}}{z}\right)} - 1 \]
      8. sqr-neg57.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{-\frac{t}{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}}}{z}\right)} - 1 \]
      9. sqrt-unprod34.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{-\frac{t}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z}\right)} - 1 \]
      10. add-sqr-sqrt58.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{-\frac{t}{\color{blue}{-x}}}}{z}\right)} - 1 \]
      11. distribute-frac-neg58.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{\color{blue}{\frac{-t}{-x}}}}{z}\right)} - 1 \]
      12. frac-2neg58.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\frac{1}{\color{blue}{\frac{t}{x}}}}{z}\right)} - 1 \]
      13. clear-num58.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{x}{t}}}{z}\right)} - 1 \]
    10. Applied egg-rr58.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{x}{t}}{z}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def55.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{x}{t}}{z}\right)\right)} \]
      2. expm1-log1p55.3%

        \[\leadsto \color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. associate-/l/55.4%

        \[\leadsto \color{blue}{\frac{x}{z \cdot t}} \]
      4. associate-/r*58.0%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    12. Simplified58.0%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]

    if -2.79999999999999983e140 < z < 5.19999999999999963e80

    1. Initial program 98.7%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 60.7%

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

    if 5.19999999999999963e80 < z

    1. Initial program 88.3%

      \[\frac{x}{y - z \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg88.3%

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

        \[\leadsto \frac{x}{\color{blue}{\left(-z \cdot t\right) + y}} \]
      3. distribute-rgt-neg-in88.3%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-t\right)} + y} \]
      4. fma-udef88.3%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, -t, y\right)}} \]
      5. clear-num87.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(z, -t, y\right)}{x}}} \]
      6. inv-pow87.7%

        \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, -t, y\right)}{x}\right)}^{-1}} \]
      7. add-sqr-sqrt48.8%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}, y\right)}{x}\right)}^{-1} \]
      8. sqrt-unprod67.3%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}, y\right)}{x}\right)}^{-1} \]
      9. sqr-neg67.3%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \sqrt{\color{blue}{t \cdot t}}, y\right)}{x}\right)}^{-1} \]
      10. sqrt-unprod21.7%

        \[\leadsto {\left(\frac{\mathsf{fma}\left(z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}, y\right)}{x}\right)}^{-1} \]
      11. add-sqr-sqrt50.9%

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

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, t, y\right)}{x}\right)}^{-1}} \]
    4. Taylor expanded in z around inf 31.8%

      \[\leadsto \color{blue}{\frac{x}{t \cdot z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{x}{z}}{t}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+80}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \end{array} \]

Alternative 8: 54.2% accurate, 2.3× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \frac{x}{y} \end{array} \]
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (/ x y))
assert(z < t);
double code(double x, double y, double z, double t) {
	return x / y;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x / y
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	return x / y;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	return x / y
z, t = sort([z, t])
function code(x, y, z, t)
	return Float64(x / y)
end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
	tmp = x / y;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 95.8%

    \[\frac{x}{y - z \cdot t} \]
  2. Taylor expanded in y around inf 50.1%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Final simplification50.1%

    \[\leadsto \frac{x}{y} \]

Developer target: 96.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\ \mathbf{if}\;x < -1.618195973607049 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x < 2.1378306434876444 \cdot 10^{+131}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ 1.0 (- (/ y x) (* (/ z x) t)))))
   (if (< x -1.618195973607049e+50)
     t_1
     (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = 1.0 / ((y / x) - ((z / x) * t));
	double tmp;
	if (x < -1.618195973607049e+50) {
		tmp = t_1;
	} else if (x < 2.1378306434876444e+131) {
		tmp = x / (y - (z * t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = 1.0d0 / ((y / x) - ((z / x) * t))
    if (x < (-1.618195973607049d+50)) then
        tmp = t_1
    else if (x < 2.1378306434876444d+131) then
        tmp = x / (y - (z * t))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 1.0 / ((y / x) - ((z / x) * t));
	double tmp;
	if (x < -1.618195973607049e+50) {
		tmp = t_1;
	} else if (x < 2.1378306434876444e+131) {
		tmp = x / (y - (z * t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 1.0 / ((y / x) - ((z / x) * t))
	tmp = 0
	if x < -1.618195973607049e+50:
		tmp = t_1
	elif x < 2.1378306434876444e+131:
		tmp = x / (y - (z * t))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(1.0 / Float64(Float64(y / x) - Float64(Float64(z / x) * t)))
	tmp = 0.0
	if (x < -1.618195973607049e+50)
		tmp = t_1;
	elseif (x < 2.1378306434876444e+131)
		tmp = Float64(x / Float64(y - Float64(z * t)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 1.0 / ((y / x) - ((z / x) * t));
	tmp = 0.0;
	if (x < -1.618195973607049e+50)
		tmp = t_1;
	elseif (x < 2.1378306434876444e+131)
		tmp = x / (y - (z * t));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[(y / x), $MachinePrecision] - N[(N[(z / x), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[x, -1.618195973607049e+50], t$95$1, If[Less[x, 2.1378306434876444e+131], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\
\mathbf{if}\;x < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x < 2.1378306434876444 \cdot 10^{+131}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023293 
(FPCore (x y z t)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
  :precision binary64

  :herbie-target
  (if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))

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