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

Percentage Accurate: 96.0% → 99.7%
Time: 6.8s
Alternatives: 9
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 9 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: 96.0% 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.5× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+243}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{t \cdot \frac{z}{x}}\\ \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 t) (- INFINITY))
   (/ (/ (- x) t) z)
   (if (<= (* z t) 2e+243) (/ x (- y (* z t))) (/ -1.0 (* t (/ z x))))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -((double) INFINITY)) {
		tmp = (-x / t) / z;
	} else if ((z * t) <= 2e+243) {
		tmp = x / (y - (z * t));
	} else {
		tmp = -1.0 / (t * (z / x));
	}
	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) {
		tmp = (-x / t) / z;
	} else if ((z * t) <= 2e+243) {
		tmp = x / (y - (z * t));
	} else {
		tmp = -1.0 / (t * (z / x));
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if (z * t) <= -math.inf:
		tmp = (-x / t) / z
	elif (z * t) <= 2e+243:
		tmp = x / (y - (z * t))
	else:
		tmp = -1.0 / (t * (z / x))
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * t) <= Float64(-Inf))
		tmp = Float64(Float64(Float64(-x) / t) / z);
	elseif (Float64(z * t) <= 2e+243)
		tmp = Float64(x / Float64(y - Float64(z * t)));
	else
		tmp = Float64(-1.0 / Float64(t * Float64(z / x)));
	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)
		tmp = (-x / t) / z;
	elseif ((z * t) <= 2e+243)
		tmp = x / (y - (z * t));
	else
		tmp = -1.0 / (t * (z / x));
	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[N[(z * t), $MachinePrecision], (-Infinity)], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+243], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\

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

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


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

    1. Initial program 78.9%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative78.9%

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

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

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

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

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

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

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

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

    1. Initial program 99.9%

      \[\frac{x}{y - z \cdot t} \]

    if 2.0000000000000001e243 < (*.f64 z t)

    1. Initial program 71.9%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative71.9%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t} \cdot \frac{-1}{z}} \]
      2. clear-num99.5%

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

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

        \[\leadsto \frac{\color{blue}{-1}}{\frac{t}{x} \cdot z} \]
      5. associate-/r/99.7%

        \[\leadsto \frac{-1}{\color{blue}{\frac{t}{\frac{x}{z}}}} \]
      6. div-inv99.7%

        \[\leadsto \frac{-1}{\color{blue}{t \cdot \frac{1}{\frac{x}{z}}}} \]
      7. clear-num99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+243}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{t \cdot \frac{z}{x}}\\ \end{array} \]

Alternative 2: 72.6% accurate, 0.7× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-25} \lor \neg \left(y \leq 10^{-97}\right):\\ \;\;\;\;\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 (or (<= y -4.5e-25) (not (<= y 1e-97))) (/ x y) (/ (- x) (* z t))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -4.5e-25) || !(y <= 1e-97)) {
		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 ((y <= (-4.5d-25)) .or. (.not. (y <= 1d-97))) 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 ((y <= -4.5e-25) || !(y <= 1e-97)) {
		tmp = x / y;
	} else {
		tmp = -x / (z * t);
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if (y <= -4.5e-25) or not (y <= 1e-97):
		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 ((y <= -4.5e-25) || !(y <= 1e-97))
		tmp = Float64(x / y);
	else
		tmp = Float64(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 ((y <= -4.5e-25) || ~((y <= 1e-97)))
		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[Or[LessEqual[y, -4.5e-25], N[Not[LessEqual[y, 1e-97]], $MachinePrecision]], 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}\;y \leq -4.5 \cdot 10^{-25} \lor \neg \left(y \leq 10^{-97}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.5000000000000001e-25 or 1.00000000000000004e-97 < y

    1. Initial program 95.8%

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

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

    if -4.5000000000000001e-25 < y < 1.00000000000000004e-97

    1. Initial program 94.8%

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

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

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

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

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

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

Alternative 3: 72.6% accurate, 0.7× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+46} \lor \neg \left(z \leq 1.4 \cdot 10^{-57}\right):\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \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 (<= z -4.1e+46) (not (<= z 1.4e-57))) (/ (/ (- x) t) z) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -4.1e+46) || !(z <= 1.4e-57)) {
		tmp = (-x / t) / z;
	} 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 ((z <= (-4.1d+46)) .or. (.not. (z <= 1.4d-57))) then
        tmp = (-x / t) / z
    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 ((z <= -4.1e+46) || !(z <= 1.4e-57)) {
		tmp = (-x / t) / z;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if (z <= -4.1e+46) or not (z <= 1.4e-57):
		tmp = (-x / t) / z
	else:
		tmp = x / y
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -4.1e+46) || !(z <= 1.4e-57))
		tmp = Float64(Float64(Float64(-x) / t) / z);
	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 ((z <= -4.1e+46) || ~((z <= 1.4e-57)))
		tmp = (-x / t) / z;
	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[z, -4.1e+46], N[Not[LessEqual[z, 1.4e-57]], $MachinePrecision]], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+46} \lor \neg \left(z \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.1e46 or 1.4e-57 < z

    1. Initial program 90.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative62.3%

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{-x}}{t}}{z} \]
    8. Applied egg-rr70.8%

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

    if -4.1e46 < z < 1.4e-57

    1. Initial program 99.9%

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

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

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

Alternative 4: 73.7% accurate, 0.7× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+46} \lor \neg \left(z \leq 1.4 \cdot 10^{-57}\right):\\ \;\;\;\;\frac{\frac{-x}{z}}{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 (<= z -1.55e+46) (not (<= z 1.4e-57))) (/ (/ (- x) z) t) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.55e+46) || !(z <= 1.4e-57)) {
		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 ((z <= (-1.55d+46)) .or. (.not. (z <= 1.4d-57))) 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 ((z <= -1.55e+46) || !(z <= 1.4e-57)) {
		tmp = (-x / z) / t;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if (z <= -1.55e+46) or not (z <= 1.4e-57):
		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 ((z <= -1.55e+46) || !(z <= 1.4e-57))
		tmp = Float64(Float64(Float64(-x) / 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 ((z <= -1.55e+46) || ~((z <= 1.4e-57)))
		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[z, -1.55e+46], N[Not[LessEqual[z, 1.4e-57]], $MachinePrecision]], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+46} \lor \neg \left(z \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.54999999999999988e46 or 1.4e-57 < z

    1. Initial program 90.6%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
      3. *-commutative62.3%

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

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

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

    if -1.54999999999999988e46 < z < 1.4e-57

    1. Initial program 99.9%

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

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

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

Alternative 5: 73.7% accurate, 0.7× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+46}:\\ \;\;\;\;\frac{-1}{t} \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-59}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-x}{z}}{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 -1.05e+46)
   (* (/ -1.0 t) (/ x z))
   (if (<= z 2.2e-59) (/ x y) (/ (/ (- x) z) t))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.05e+46) {
		tmp = (-1.0 / t) * (x / z);
	} else if (z <= 2.2e-59) {
		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 <= (-1.05d+46)) then
        tmp = ((-1.0d0) / t) * (x / z)
    else if (z <= 2.2d-59) 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 <= -1.05e+46) {
		tmp = (-1.0 / t) * (x / z);
	} else if (z <= 2.2e-59) {
		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 <= -1.05e+46:
		tmp = (-1.0 / t) * (x / z)
	elif z <= 2.2e-59:
		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 <= -1.05e+46)
		tmp = Float64(Float64(-1.0 / t) * Float64(x / z));
	elseif (z <= 2.2e-59)
		tmp = Float64(x / y);
	else
		tmp = Float64(Float64(Float64(-x) / 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 <= -1.05e+46)
		tmp = (-1.0 / t) * (x / z);
	elseif (z <= 2.2e-59)
		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, -1.05e+46], N[(N[(-1.0 / t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-59], N[(x / y), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+46}:\\
\;\;\;\;\frac{-1}{t} \cdot \frac{x}{z}\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-59}:\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 86.3%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. times-frac82.1%

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

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

    if -1.05e46 < z < 2.1999999999999999e-59

    1. Initial program 99.9%

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

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

    if 2.1999999999999999e-59 < z

    1. Initial program 93.5%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
      3. *-commutative60.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+46}:\\ \;\;\;\;\frac{-1}{t} \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-59}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-x}{z}}{t}\\ \end{array} \]

Alternative 6: 60.0% accurate, 0.8× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{-34}:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{elif}\;t \leq 7.1 \cdot 10^{+189}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{z}\\ \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 (<= t -1.6e-34) (/ x (* z t)) (if (<= t 7.1e+189) (/ x y) (/ (/ x t) z))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.6e-34) {
		tmp = x / (z * t);
	} else if (t <= 7.1e+189) {
		tmp = x / y;
	} else {
		tmp = (x / t) / z;
	}
	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 <= (-1.6d-34)) then
        tmp = x / (z * t)
    else if (t <= 7.1d+189) then
        tmp = x / y
    else
        tmp = (x / t) / z
    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 <= -1.6e-34) {
		tmp = x / (z * t);
	} else if (t <= 7.1e+189) {
		tmp = x / y;
	} else {
		tmp = (x / t) / z;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if t <= -1.6e-34:
		tmp = x / (z * t)
	elif t <= 7.1e+189:
		tmp = x / y
	else:
		tmp = (x / t) / z
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.6e-34)
		tmp = Float64(x / Float64(z * t));
	elseif (t <= 7.1e+189)
		tmp = Float64(x / y);
	else
		tmp = Float64(Float64(x / t) / z);
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.6e-34)
		tmp = x / (z * t);
	elseif (t <= 7.1e+189)
		tmp = x / y;
	else
		tmp = (x / t) / z;
	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[t, -1.6e-34], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.1e+189], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-34}:\\
\;\;\;\;\frac{x}{z \cdot t}\\

\mathbf{elif}\;t \leq 7.1 \cdot 10^{+189}:\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.60000000000000001e-34

    1. Initial program 92.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{z}}{t}} \]
      2. expm1-log1p-u64.6%

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{z \cdot t}\right)} - 1 \]
    6. Applied egg-rr36.5%

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

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

        \[\leadsto \color{blue}{\frac{x}{z \cdot t}} \]
      3. *-commutative34.0%

        \[\leadsto \frac{x}{\color{blue}{t \cdot z}} \]
    8. Simplified34.0%

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

    if -1.60000000000000001e-34 < t < 7.1e189

    1. Initial program 97.9%

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

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

    if 7.1e189 < t

    1. Initial program 89.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{z}}{t}} \]
      2. expm1-log1p-u89.1%

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{z \cdot t}\right)} - 1 \]
    6. Applied egg-rr51.8%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    8. Simplified46.0%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    9. Taylor expanded in x around 0 46.2%

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

        \[\leadsto \color{blue}{\frac{\frac{x}{t}}{z}} \]
    11. Simplified51.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{-34}:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{elif}\;t \leq 7.1 \cdot 10^{+189}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{z}\\ \end{array} \]

Alternative 7: 57.4% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+229}:\\ \;\;\;\;\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 (<= z -1.05e+229) (/ x (* z t)) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.05e+229) {
		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 (z <= (-1.05d+229)) 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 (z <= -1.05e+229) {
		tmp = x / (z * t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if z <= -1.05e+229:
		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 (z <= -1.05e+229)
		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 (z <= -1.05e+229)
		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[z, -1.05e+229], 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}\;z \leq -1.05 \cdot 10^{+229}:\\
\;\;\;\;\frac{x}{z \cdot t}\\

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


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

    1. Initial program 80.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{z}}{t}} \]
      2. expm1-log1p-u88.2%

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{z \cdot t}\right)} - 1 \]
    6. Applied egg-rr50.7%

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

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

        \[\leadsto \color{blue}{\frac{x}{z \cdot t}} \]
      3. *-commutative50.2%

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

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

    if -1.04999999999999994e229 < z

    1. Initial program 96.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+229}:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 8: 57.9% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{x}{z}}{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 (<= z -7.8e+153) (/ (/ x z) t) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -7.8e+153) {
		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 (z <= (-7.8d+153)) 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 (z <= -7.8e+153) {
		tmp = (x / z) / t;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if z <= -7.8e+153:
		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 (z <= -7.8e+153)
		tmp = Float64(Float64(x / 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 (z <= -7.8e+153)
		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[z, -7.8e+153], N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{x}{z}}{t}\\

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


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

    1. Initial program 88.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{z}}{t}} \]
      2. expm1-log1p-u86.4%

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{z \cdot t}\right)} - 1 \]
    6. Applied egg-rr61.7%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    8. Simplified61.2%

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

    if -7.79999999999999966e153 < z

    1. Initial program 96.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 9: 55.0% 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.4%

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

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Final simplification59.6%

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

Developer target: 96.5% 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 2023310 
(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))))