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

Percentage Accurate: 95.9% → 99.0%
Time: 10.0s
Alternatives: 7
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 7 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.9% 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.0% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{\frac{x}{t}}{0 - z}\\ \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+301}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 10^{+158}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (/ x t) (- 0.0 z))))
   (if (<= (* z t) -1e+301)
     t_1
     (if (<= (* z t) 1e+158) (/ x (- y (* z t))) t_1))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = (x / t) / (0.0 - z);
	double tmp;
	if ((z * t) <= -1e+301) {
		tmp = t_1;
	} else if ((z * t) <= 1e+158) {
		tmp = x / (y - (z * t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, 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) :: tmp
    t_1 = (x / t) / (0.0d0 - z)
    if ((z * t) <= (-1d+301)) then
        tmp = t_1
    else if ((z * t) <= 1d+158) then
        tmp = x / (y - (z * t))
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / t) / (0.0 - z);
	double tmp;
	if ((z * t) <= -1e+301) {
		tmp = t_1;
	} else if ((z * t) <= 1e+158) {
		tmp = x / (y - (z * t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = (x / t) / (0.0 - z)
	tmp = 0
	if (z * t) <= -1e+301:
		tmp = t_1
	elif (z * t) <= 1e+158:
		tmp = x / (y - (z * t))
	else:
		tmp = t_1
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(Float64(x / t) / Float64(0.0 - z))
	tmp = 0.0
	if (Float64(z * t) <= -1e+301)
		tmp = t_1;
	elseif (Float64(z * t) <= 1e+158)
		tmp = Float64(x / Float64(y - Float64(z * t)));
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = (x / t) / (0.0 - z);
	tmp = 0.0;
	if ((z * t) <= -1e+301)
		tmp = t_1;
	elseif ((z * t) <= 1e+158)
		tmp = x / (y - (z * t));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] / N[(0.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+301], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+158], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{t}}{0 - z}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.00000000000000005e301 or 9.99999999999999953e157 < (*.f64 z t)

    1. Initial program 83.5%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y - z \cdot t}{x}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{y - z \cdot t} \cdot \color{blue}{x} \]
      3. flip--N/A

        \[\leadsto \frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}} \cdot x \]
      4. clear-numN/A

        \[\leadsto \frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot x \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}\right), \color{blue}{x}\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}}\right), x\right) \]
      7. flip--N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{y - z \cdot t}\right), x\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(y - z \cdot t\right)\right), x\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \left(z \cdot t\right)\right)\right), x\right) \]
      10. *-lowering-*.f6483.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \mathsf{*.f64}\left(z, t\right)\right)\right), x\right) \]
    4. Applied egg-rr83.6%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{-1}{t \cdot z}\right)}, x\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \left(t \cdot z\right)\right), x\right) \]
      2. *-lowering-*.f6483.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(t, z\right)\right), x\right) \]
    7. Simplified83.6%

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

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{t \cdot z}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{\color{blue}{t} \cdot z} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{t}}{\color{blue}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\mathsf{neg}\left(x\right)}{t}\right), \color{blue}{z}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), t\right), z\right) \]
      6. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(0 - x\right), t\right), z\right) \]
      7. --lowering--.f6499.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, x\right), t\right), z\right) \]
    9. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{0 - x}{t}}{z}} \]
    10. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), t\right), z\right) \]
      2. neg-lowering-neg.f6499.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(x\right), t\right), z\right) \]
    11. Applied egg-rr99.8%

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

    if -1.00000000000000005e301 < (*.f64 z t) < 9.99999999999999953e157

    1. Initial program 99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+301}:\\ \;\;\;\;\frac{\frac{x}{t}}{0 - z}\\ \mathbf{elif}\;z \cdot t \leq 10^{+158}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{0 - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 78.5% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-86}:\\ \;\;\;\;\frac{0 - \frac{x}{z}}{t}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{0 - z}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z t) -1e-86)
   (/ (- 0.0 (/ x z)) t)
   (if (<= (* z t) 2e-12) (/ x y) (/ (/ x t) (- 0.0 z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -1e-86) {
		tmp = (0.0 - (x / z)) / t;
	} else if ((z * t) <= 2e-12) {
		tmp = x / y;
	} else {
		tmp = (x / t) / (0.0 - z);
	}
	return tmp;
}
NOTE: x, y, 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 * t) <= (-1d-86)) then
        tmp = (0.0d0 - (x / z)) / t
    else if ((z * t) <= 2d-12) then
        tmp = x / y
    else
        tmp = (x / t) / (0.0d0 - z)
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -1e-86) {
		tmp = (0.0 - (x / z)) / t;
	} else if ((z * t) <= 2e-12) {
		tmp = x / y;
	} else {
		tmp = (x / t) / (0.0 - z);
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if (z * t) <= -1e-86:
		tmp = (0.0 - (x / z)) / t
	elif (z * t) <= 2e-12:
		tmp = x / y
	else:
		tmp = (x / t) / (0.0 - z)
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * t) <= -1e-86)
		tmp = Float64(Float64(0.0 - Float64(x / z)) / t);
	elseif (Float64(z * t) <= 2e-12)
		tmp = Float64(x / y);
	else
		tmp = Float64(Float64(x / t) / Float64(0.0 - z));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * t) <= -1e-86)
		tmp = (0.0 - (x / z)) / t;
	elseif ((z * t) <= 2e-12)
		tmp = x / y;
	else
		tmp = (x / t) / (0.0 - z);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e-86], N[(N[(0.0 - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-12], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / N[(0.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-86}:\\
\;\;\;\;\frac{0 - \frac{x}{z}}{t}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -1.00000000000000008e-86

    1. Initial program 94.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y - z \cdot t}{x}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{y - z \cdot t} \cdot \color{blue}{x} \]
      3. flip--N/A

        \[\leadsto \frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}} \cdot x \]
      4. clear-numN/A

        \[\leadsto \frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot x \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}\right), \color{blue}{x}\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}}\right), x\right) \]
      7. flip--N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{y - z \cdot t}\right), x\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(y - z \cdot t\right)\right), x\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \left(z \cdot t\right)\right)\right), x\right) \]
      10. *-lowering-*.f6494.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \mathsf{*.f64}\left(z, t\right)\right)\right), x\right) \]
    4. Applied egg-rr94.0%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{-1}{t \cdot z}\right)}, x\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \left(t \cdot z\right)\right), x\right) \]
      2. *-lowering-*.f6472.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(t, z\right)\right), x\right) \]
    7. Simplified72.1%

      \[\leadsto \color{blue}{\frac{-1}{t \cdot z}} \cdot x \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{-1}{z \cdot t} \cdot x \]
      2. associate-*l/N/A

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      3. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{\color{blue}{z} \cdot t} \]
      4. associate-/r*N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{z}}{\color{blue}{t}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\mathsf{neg}\left(x\right)}{z}\right), \color{blue}{t}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), z\right), t\right) \]
      7. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(0 - x\right), z\right), t\right) \]
      8. --lowering--.f6474.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, x\right), z\right), t\right) \]
    9. Applied egg-rr74.4%

      \[\leadsto \color{blue}{\frac{\frac{0 - x}{z}}{t}} \]
    10. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), z\right), t\right) \]
      2. neg-lowering-neg.f6474.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(x\right), z\right), t\right) \]
    11. Applied egg-rr74.4%

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

    if -1.00000000000000008e-86 < (*.f64 z t) < 1.99999999999999996e-12

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6484.9%

        \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
    5. Simplified84.9%

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

    if 1.99999999999999996e-12 < (*.f64 z t)

    1. Initial program 92.4%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y - z \cdot t}{x}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{y - z \cdot t} \cdot \color{blue}{x} \]
      3. flip--N/A

        \[\leadsto \frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}} \cdot x \]
      4. clear-numN/A

        \[\leadsto \frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot x \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}\right), \color{blue}{x}\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}}\right), x\right) \]
      7. flip--N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{y - z \cdot t}\right), x\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(y - z \cdot t\right)\right), x\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \left(z \cdot t\right)\right)\right), x\right) \]
      10. *-lowering-*.f6492.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \mathsf{*.f64}\left(z, t\right)\right)\right), x\right) \]
    4. Applied egg-rr92.5%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{-1}{t \cdot z}\right)}, x\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \left(t \cdot z\right)\right), x\right) \]
      2. *-lowering-*.f6480.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(t, z\right)\right), x\right) \]
    7. Simplified80.7%

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

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{t \cdot z}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{\color{blue}{t} \cdot z} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{t}}{\color{blue}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\mathsf{neg}\left(x\right)}{t}\right), \color{blue}{z}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), t\right), z\right) \]
      6. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(0 - x\right), t\right), z\right) \]
      7. --lowering--.f6485.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, x\right), t\right), z\right) \]
    9. Applied egg-rr85.2%

      \[\leadsto \color{blue}{\frac{\frac{0 - x}{t}}{z}} \]
    10. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), t\right), z\right) \]
      2. neg-lowering-neg.f6485.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(x\right), t\right), z\right) \]
    11. Applied egg-rr85.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-86}:\\ \;\;\;\;\frac{0 - \frac{x}{z}}{t}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{0 - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.7% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{\frac{x}{t}}{0 - z}\\ \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-9}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (/ x t) (- 0.0 z))))
   (if (<= (* z t) -1e-9) t_1 (if (<= (* z t) 2e-12) (/ x y) t_1))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = (x / t) / (0.0 - z);
	double tmp;
	if ((z * t) <= -1e-9) {
		tmp = t_1;
	} else if ((z * t) <= 2e-12) {
		tmp = x / y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, 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) :: tmp
    t_1 = (x / t) / (0.0d0 - z)
    if ((z * t) <= (-1d-9)) then
        tmp = t_1
    else if ((z * t) <= 2d-12) then
        tmp = x / y
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / t) / (0.0 - z);
	double tmp;
	if ((z * t) <= -1e-9) {
		tmp = t_1;
	} else if ((z * t) <= 2e-12) {
		tmp = x / y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = (x / t) / (0.0 - z)
	tmp = 0
	if (z * t) <= -1e-9:
		tmp = t_1
	elif (z * t) <= 2e-12:
		tmp = x / y
	else:
		tmp = t_1
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(Float64(x / t) / Float64(0.0 - z))
	tmp = 0.0
	if (Float64(z * t) <= -1e-9)
		tmp = t_1;
	elseif (Float64(z * t) <= 2e-12)
		tmp = Float64(x / y);
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = (x / t) / (0.0 - z);
	tmp = 0.0;
	if ((z * t) <= -1e-9)
		tmp = t_1;
	elseif ((z * t) <= 2e-12)
		tmp = x / y;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] / N[(0.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e-9], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e-12], N[(x / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{t}}{0 - z}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.00000000000000006e-9 or 1.99999999999999996e-12 < (*.f64 z t)

    1. Initial program 92.8%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y - z \cdot t}{x}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{y - z \cdot t} \cdot \color{blue}{x} \]
      3. flip--N/A

        \[\leadsto \frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}} \cdot x \]
      4. clear-numN/A

        \[\leadsto \frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot x \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{y + z \cdot t}{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}\right), \color{blue}{x}\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{y \cdot y - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{y + z \cdot t}}\right), x\right) \]
      7. flip--N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{y - z \cdot t}\right), x\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(y - z \cdot t\right)\right), x\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \left(z \cdot t\right)\right)\right), x\right) \]
      10. *-lowering-*.f6492.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(y, \mathsf{*.f64}\left(z, t\right)\right)\right), x\right) \]
    4. Applied egg-rr92.9%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{-1}{t \cdot z}\right)}, x\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \left(t \cdot z\right)\right), x\right) \]
      2. *-lowering-*.f6477.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(t, z\right)\right), x\right) \]
    7. Simplified77.4%

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

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{t \cdot z}} \]
      2. neg-mul-1N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{\color{blue}{t} \cdot z} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{t}}{\color{blue}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\mathsf{neg}\left(x\right)}{t}\right), \color{blue}{z}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), t\right), z\right) \]
      6. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(0 - x\right), t\right), z\right) \]
      7. --lowering--.f6482.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, x\right), t\right), z\right) \]
    9. Applied egg-rr82.6%

      \[\leadsto \color{blue}{\frac{\frac{0 - x}{t}}{z}} \]
    10. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(x\right)\right), t\right), z\right) \]
      2. neg-lowering-neg.f6482.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(x\right), t\right), z\right) \]
    11. Applied egg-rr82.6%

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

    if -1.00000000000000006e-9 < (*.f64 z t) < 1.99999999999999996e-12

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6481.4%

        \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
    5. Simplified81.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-9}:\\ \;\;\;\;\frac{\frac{x}{t}}{0 - z}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{0 - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 76.9% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := 0 - \frac{x}{z \cdot t}\\ \mathbf{if}\;z \cdot t \leq -1.02 \cdot 10^{-86}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 1.65:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- 0.0 (/ x (* z t)))))
   (if (<= (* z t) -1.02e-86) t_1 (if (<= (* z t) 1.65) (/ x y) t_1))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = 0.0 - (x / (z * t));
	double tmp;
	if ((z * t) <= -1.02e-86) {
		tmp = t_1;
	} else if ((z * t) <= 1.65) {
		tmp = x / y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, 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) :: tmp
    t_1 = 0.0d0 - (x / (z * t))
    if ((z * t) <= (-1.02d-86)) then
        tmp = t_1
    else if ((z * t) <= 1.65d0) then
        tmp = x / y
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = 0.0 - (x / (z * t));
	double tmp;
	if ((z * t) <= -1.02e-86) {
		tmp = t_1;
	} else if ((z * t) <= 1.65) {
		tmp = x / y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = 0.0 - (x / (z * t))
	tmp = 0
	if (z * t) <= -1.02e-86:
		tmp = t_1
	elif (z * t) <= 1.65:
		tmp = x / y
	else:
		tmp = t_1
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(0.0 - Float64(x / Float64(z * t)))
	tmp = 0.0
	if (Float64(z * t) <= -1.02e-86)
		tmp = t_1;
	elseif (Float64(z * t) <= 1.65)
		tmp = Float64(x / y);
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = 0.0 - (x / (z * t));
	tmp = 0.0;
	if ((z * t) <= -1.02e-86)
		tmp = t_1;
	elseif ((z * t) <= 1.65)
		tmp = x / y;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1.02e-86], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1.65], N[(x / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 0 - \frac{x}{z \cdot t}\\
\mathbf{if}\;z \cdot t \leq -1.02 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 1.65:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.02000000000000005e-86 or 1.6499999999999999 < (*.f64 z t)

    1. Initial program 93.3%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z} + -1 \cdot \frac{x \cdot y}{{t}^{2} \cdot {z}^{2}}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto -1 \cdot \frac{x}{t \cdot z} + \left(\mathsf{neg}\left(\frac{x \cdot y}{{t}^{2} \cdot {z}^{2}}\right)\right) \]
      2. unsub-negN/A

        \[\leadsto -1 \cdot \frac{x}{t \cdot z} - \color{blue}{\frac{x \cdot y}{{t}^{2} \cdot {z}^{2}}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{-1 \cdot x}{t \cdot z} - \frac{\color{blue}{x \cdot y}}{{t}^{2} \cdot {z}^{2}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{x \cdot -1}{t \cdot z} - \frac{\color{blue}{x} \cdot y}{{t}^{2} \cdot {z}^{2}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{x \cdot -1}{z \cdot t} - \frac{x \cdot \color{blue}{y}}{{t}^{2} \cdot {z}^{2}} \]
      6. times-fracN/A

        \[\leadsto \frac{x}{z} \cdot \frac{-1}{t} - \frac{\color{blue}{x \cdot y}}{{t}^{2} \cdot {z}^{2}} \]
      7. associate-/r*N/A

        \[\leadsto \frac{x}{z} \cdot \frac{-1}{t} - \frac{\frac{x \cdot y}{{t}^{2}}}{\color{blue}{{z}^{2}}} \]
      8. associate-/l*N/A

        \[\leadsto \frac{x}{z} \cdot \frac{-1}{t} - \frac{x \cdot \frac{y}{{t}^{2}}}{{\color{blue}{z}}^{2}} \]
      9. unpow2N/A

        \[\leadsto \frac{x}{z} \cdot \frac{-1}{t} - \frac{x \cdot \frac{y}{{t}^{2}}}{z \cdot \color{blue}{z}} \]
      10. times-fracN/A

        \[\leadsto \frac{x}{z} \cdot \frac{-1}{t} - \frac{x}{z} \cdot \color{blue}{\frac{\frac{y}{{t}^{2}}}{z}} \]
      11. associate-/r*N/A

        \[\leadsto \frac{x}{z} \cdot \frac{-1}{t} - \frac{x}{z} \cdot \frac{y}{\color{blue}{{t}^{2} \cdot z}} \]
      12. distribute-lft-out--N/A

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(\frac{-1}{t} - \frac{y}{{t}^{2} \cdot z}\right)} \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{z}\right), \color{blue}{\left(\frac{-1}{t} - \frac{y}{{t}^{2} \cdot z}\right)}\right) \]
      14. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \left(\color{blue}{\frac{-1}{t}} - \frac{y}{{t}^{2} \cdot z}\right)\right) \]
      15. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \mathsf{\_.f64}\left(\left(\frac{-1}{t}\right), \color{blue}{\left(\frac{y}{{t}^{2} \cdot z}\right)}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(-1, t\right), \left(\frac{\color{blue}{y}}{{t}^{2} \cdot z}\right)\right)\right) \]
      17. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(-1, t\right), \mathsf{/.f64}\left(y, \color{blue}{\left({t}^{2} \cdot z\right)}\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(-1, t\right), \mathsf{/.f64}\left(y, \left(\left(t \cdot t\right) \cdot z\right)\right)\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(-1, t\right), \mathsf{/.f64}\left(y, \left(t \cdot \color{blue}{\left(t \cdot z\right)}\right)\right)\right)\right) \]
      20. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(-1, t\right), \mathsf{/.f64}\left(y, \mathsf{*.f64}\left(t, \color{blue}{\left(t \cdot z\right)}\right)\right)\right)\right) \]
      21. *-lowering-*.f6477.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, z\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(-1, t\right), \mathsf{/.f64}\left(y, \mathsf{*.f64}\left(t, \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right)\right)\right) \]
    5. Simplified77.2%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{-1}{t} - \frac{y}{t \cdot \left(t \cdot z\right)}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{-1}{t} - \frac{y}{t \cdot \left(t \cdot z\right)}\right) \cdot \color{blue}{\frac{x}{z}} \]
      2. clear-numN/A

        \[\leadsto \left(\frac{-1}{t} - \frac{y}{t \cdot \left(t \cdot z\right)}\right) \cdot \frac{1}{\color{blue}{\frac{z}{x}}} \]
      3. un-div-invN/A

        \[\leadsto \frac{\frac{-1}{t} - \frac{y}{t \cdot \left(t \cdot z\right)}}{\color{blue}{\frac{z}{x}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{t} - \frac{y}{t \cdot \left(t \cdot z\right)}\right), \color{blue}{\left(\frac{z}{x}\right)}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{t} - \frac{y}{\left(t \cdot z\right) \cdot t}\right), \left(\frac{z}{x}\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{t} - \frac{y}{\left(z \cdot t\right) \cdot t}\right), \left(\frac{z}{x}\right)\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{t} - \frac{\frac{y}{z \cdot t}}{t}\right), \left(\frac{z}{x}\right)\right) \]
      8. sub-divN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1 - \frac{y}{z \cdot t}}{t}\right), \left(\frac{\color{blue}{z}}{x}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-1 - \frac{y}{z \cdot t}\right), t\right), \left(\frac{\color{blue}{z}}{x}\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(-1, \left(\frac{y}{z \cdot t}\right)\right), t\right), \left(\frac{z}{x}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(-1, \mathsf{/.f64}\left(y, \left(z \cdot t\right)\right)\right), t\right), \left(\frac{z}{x}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(-1, \mathsf{/.f64}\left(y, \mathsf{*.f64}\left(z, t\right)\right)\right), t\right), \left(\frac{z}{x}\right)\right) \]
      13. /-lowering-/.f6477.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(-1, \mathsf{/.f64}\left(y, \mathsf{*.f64}\left(z, t\right)\right)\right), t\right), \mathsf{/.f64}\left(z, \color{blue}{x}\right)\right) \]
    7. Applied egg-rr77.0%

      \[\leadsto \color{blue}{\frac{\frac{-1 - \frac{y}{z \cdot t}}{t}}{\frac{z}{x}}} \]
    8. Taylor expanded in y around 0

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{-1}{t}\right)}, \mathsf{/.f64}\left(z, x\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6478.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(-1, t\right), \mathsf{/.f64}\left(\color{blue}{z}, x\right)\right) \]
    10. Simplified78.5%

      \[\leadsto \frac{\color{blue}{\frac{-1}{t}}}{\frac{z}{x}} \]
    11. Step-by-step derivation
      1. associate-/r/N/A

        \[\leadsto \frac{\frac{-1}{t}}{z} \cdot \color{blue}{x} \]
      2. *-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\frac{\frac{-1}{t}}{z}} \]
      3. div-invN/A

        \[\leadsto x \cdot \frac{-1 \cdot \frac{1}{t}}{z} \]
      4. mul-1-negN/A

        \[\leadsto x \cdot \frac{\mathsf{neg}\left(\frac{1}{t}\right)}{z} \]
      5. remove-double-negN/A

        \[\leadsto x \cdot \frac{\mathsf{neg}\left(\frac{1}{t}\right)}{\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)} \]
      6. frac-2negN/A

        \[\leadsto x \cdot \frac{\frac{1}{t}}{\color{blue}{\mathsf{neg}\left(z\right)}} \]
      7. associate-*r/N/A

        \[\leadsto \frac{x \cdot \frac{1}{t}}{\color{blue}{\mathsf{neg}\left(z\right)}} \]
      8. div-invN/A

        \[\leadsto \frac{\frac{x}{t}}{\mathsf{neg}\left(\color{blue}{z}\right)} \]
      9. distribute-frac-neg2N/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{x}{t}}{z}\right) \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\frac{x}{t}}{z}\right)\right) \]
      11. associate-/r*N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{x}{t \cdot z}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{x}{z \cdot t}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(x, \left(z \cdot t\right)\right)\right) \]
      14. *-lowering-*.f6475.8%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(x, \mathsf{*.f64}\left(z, t\right)\right)\right) \]
    12. Applied egg-rr75.8%

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

    if -1.02000000000000005e-86 < (*.f64 z t) < 1.6499999999999999

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6484.9%

        \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
    5. Simplified84.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1.02 \cdot 10^{-86}:\\ \;\;\;\;0 - \frac{x}{z \cdot t}\\ \mathbf{elif}\;z \cdot t \leq 1.65:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x}{z \cdot t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 96.4% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{z \cdot \frac{\frac{y}{z} - t}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= z -1.2e+135) (/ 1.0 (* z (/ (- (/ y z) t) x))) (/ x (- y (* z t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.2e+135) {
		tmp = 1.0 / (z * (((y / z) - t) / x));
	} else {
		tmp = x / (y - (z * t));
	}
	return tmp;
}
NOTE: x, y, 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 <= (-1.2d+135)) then
        tmp = 1.0d0 / (z * (((y / z) - t) / x))
    else
        tmp = x / (y - (z * t))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.2e+135) {
		tmp = 1.0 / (z * (((y / z) - t) / x));
	} else {
		tmp = x / (y - (z * t));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if z <= -1.2e+135:
		tmp = 1.0 / (z * (((y / z) - t) / x))
	else:
		tmp = x / (y - (z * t))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -1.2e+135)
		tmp = Float64(1.0 / Float64(z * Float64(Float64(Float64(y / z) - t) / x)));
	else
		tmp = Float64(x / Float64(y - Float64(z * t)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -1.2e+135)
		tmp = 1.0 / (z * (((y / z) - t) / x));
	else
		tmp = x / (y - (z * t));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+135], N[(1.0 / N[(z * N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+135}:\\
\;\;\;\;\frac{1}{z \cdot \frac{\frac{y}{z} - t}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.19999999999999999e135

    1. Initial program 78.1%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(z \cdot \left(\frac{y}{z} - t\right)\right)}\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{y}{z} - t\right)}\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\left(\frac{y}{z}\right), \color{blue}{t}\right)\right)\right) \]
      3. /-lowering-/.f6478.2%

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, z\right), t\right)\right)\right) \]
    5. Simplified78.2%

      \[\leadsto \frac{x}{\color{blue}{z \cdot \left(\frac{y}{z} - t\right)}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{x}{\left(\frac{y}{z} - t\right) \cdot \color{blue}{z}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{\frac{y}{z} - t}}{\color{blue}{z}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{\frac{y}{z} - t}\right), \color{blue}{z}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{z} - t\right)\right), z\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{y}{z}\right), t\right)\right), z\right) \]
      6. /-lowering-/.f6496.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, z\right), t\right)\right), z\right) \]
    7. Applied egg-rr96.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{\frac{y}{z} - t}}{z}} \]
    8. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \frac{x}{\frac{y}{z} - t} \cdot \color{blue}{\frac{1}{z}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\frac{\frac{y}{z} - t}{x}} \cdot \frac{\color{blue}{1}}{z} \]
      3. frac-timesN/A

        \[\leadsto \frac{1 \cdot 1}{\color{blue}{\frac{\frac{y}{z} - t}{x} \cdot z}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{z} - t}{x}} \cdot z} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{\frac{y}{z} - t}{x} \cdot z\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(\frac{\frac{y}{z} - t}{x}\right), \color{blue}{z}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{y}{z} - t\right), x\right), z\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{y}{z}\right), t\right), x\right), z\right)\right) \]
      9. /-lowering-/.f6496.2%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, z\right), t\right), x\right), z\right)\right) \]
    9. Applied egg-rr96.2%

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

    if -1.19999999999999999e135 < z

    1. Initial program 98.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{z \cdot \frac{\frac{y}{z} - t}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 96.4% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.0999999999999999e222

    1. Initial program 71.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(z \cdot \left(\frac{y}{z} - t\right)\right)}\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{y}{z} - t\right)}\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\left(\frac{y}{z}\right), \color{blue}{t}\right)\right)\right) \]
      3. /-lowering-/.f6471.1%

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, z\right), t\right)\right)\right) \]
    5. Simplified71.1%

      \[\leadsto \frac{x}{\color{blue}{z \cdot \left(\frac{y}{z} - t\right)}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{x}{\left(\frac{y}{z} - t\right) \cdot \color{blue}{z}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{\frac{y}{z} - t}}{\color{blue}{z}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{\frac{y}{z} - t}\right), \color{blue}{z}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{z} - t\right)\right), z\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{y}{z}\right), t\right)\right), z\right) \]
      6. /-lowering-/.f6493.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, z\right), t\right)\right), z\right) \]
    7. Applied egg-rr93.8%

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

    if -5.0999999999999999e222 < z

    1. Initial program 97.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 54.4% accurate, 2.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \frac{x}{y} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (/ x y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return x / y;
}
NOTE: x, y, 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 x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return x / y;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return x / y
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(x / y)
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = x / y;
end
NOTE: x, y, 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}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 96.2%

    \[\frac{x}{y - z \cdot t} \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  4. Step-by-step derivation
    1. /-lowering-/.f6454.0%

      \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{y}\right) \]
  5. Simplified54.0%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  6. Add Preprocessing

Developer Target 1: 96.8% accurate, 0.3× 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 2024138 
(FPCore (x y z t)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< x -161819597360704900000000000000000000000000000000000) (/ 1 (- (/ y x) (* (/ z x) t))) (if (< x 213783064348764440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ x (- y (* z t))) (/ 1 (- (/ y x) (* (/ z x) t))))))

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