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

Percentage Accurate: 85.1% → 91.0%
Time: 14.1s
Alternatives: 8
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 85.1% accurate, 1.0× speedup?

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

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

Alternative 1: 91.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\ \;\;\;\;\frac{-y}{\frac{t}{z} - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - z \cdot y}{\mathsf{fma}\left(-z, a, t\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -1.12e+182) (not (<= z 4.5e+182)))
   (/ (- y) (- (/ t z) a))
   (/ (- x (* z y)) (fma (- z) a t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -1.12e+182) || !(z <= 4.5e+182)) {
		tmp = -y / ((t / z) - a);
	} else {
		tmp = (x - (z * y)) / fma(-z, a, t);
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -1.12e+182) || !(z <= 4.5e+182))
		tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a));
	else
		tmp = Float64(Float64(x - Float64(z * y)) / fma(Float64(-z), a, t));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.12e+182], N[Not[LessEqual[z, 4.5e+182]], $MachinePrecision]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[((-z) * a + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.11999999999999994e182 or 4.50000000000000029e182 < z

    1. Initial program 49.5%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified49.5%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num49.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z \cdot a}{x - y \cdot z}}} \]
      2. inv-pow49.5%

        \[\leadsto \color{blue}{{\left(\frac{t - z \cdot a}{x - y \cdot z}\right)}^{-1}} \]
      3. sub-neg49.5%

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

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

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

        \[\leadsto {\left(\frac{\color{blue}{a \cdot \left(-z\right)} + t}{x - y \cdot z}\right)}^{-1} \]
      7. fma-def49.5%

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

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(a, -z, t\right)}{x - y \cdot z}\right)}^{-1}} \]
    7. Taylor expanded in a around 0 43.4%

      \[\leadsto {\color{blue}{\left(-1 \cdot \frac{a \cdot z}{x - y \cdot z} + \frac{t}{x - y \cdot z}\right)}}^{-1} \]
    8. Step-by-step derivation
      1. +-commutative43.4%

        \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} + -1 \cdot \frac{a \cdot z}{x - y \cdot z}\right)}}^{-1} \]
      2. mul-1-neg43.4%

        \[\leadsto {\left(\frac{t}{x - y \cdot z} + \color{blue}{\left(-\frac{a \cdot z}{x - y \cdot z}\right)}\right)}^{-1} \]
      3. unsub-neg43.4%

        \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a \cdot z}{x - y \cdot z}\right)}}^{-1} \]
      4. associate-/l*55.2%

        \[\leadsto {\left(\frac{t}{x - y \cdot z} - \color{blue}{\frac{a}{\frac{x - y \cdot z}{z}}}\right)}^{-1} \]
    9. Simplified55.2%

      \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a}{\frac{x - y \cdot z}{z}}\right)}}^{-1} \]
    10. Taylor expanded in y around -inf 91.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{\frac{t}{z} - a}} \]
    11. Step-by-step derivation
      1. associate-*r/91.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{\frac{t}{z} - a}} \]
      2. mul-1-neg91.6%

        \[\leadsto \frac{\color{blue}{-y}}{\frac{t}{z} - a} \]
    12. Simplified91.6%

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

    if -1.11999999999999994e182 < z < 4.50000000000000029e182

    1. Initial program 95.5%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified95.5%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sub-neg95.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\ \;\;\;\;\frac{-y}{\frac{t}{z} - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - z \cdot y}{\mathsf{fma}\left(-z, a, t\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 70.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.65 \cdot 10^{+115} \lor \neg \left(y \leq -6.2 \cdot 10^{+71}\right) \land \left(y \leq -1.95 \cdot 10^{+31} \lor \neg \left(y \leq 9.5 \cdot 10^{-9}\right)\right):\\ \;\;\;\;\frac{-y}{\frac{t}{z} - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= y -3.65e+115)
         (and (not (<= y -6.2e+71)) (or (<= y -1.95e+31) (not (<= y 9.5e-9)))))
   (/ (- y) (- (/ t z) a))
   (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -3.65e+115) || (!(y <= -6.2e+71) && ((y <= -1.95e+31) || !(y <= 9.5e-9)))) {
		tmp = -y / ((t / z) - a);
	} else {
		tmp = x / (t - (z * a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((y <= (-3.65d+115)) .or. (.not. (y <= (-6.2d+71))) .and. (y <= (-1.95d+31)) .or. (.not. (y <= 9.5d-9))) then
        tmp = -y / ((t / z) - a)
    else
        tmp = x / (t - (z * a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -3.65e+115) || (!(y <= -6.2e+71) && ((y <= -1.95e+31) || !(y <= 9.5e-9)))) {
		tmp = -y / ((t / z) - a);
	} else {
		tmp = x / (t - (z * a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (y <= -3.65e+115) or (not (y <= -6.2e+71) and ((y <= -1.95e+31) or not (y <= 9.5e-9))):
		tmp = -y / ((t / z) - a)
	else:
		tmp = x / (t - (z * a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((y <= -3.65e+115) || (!(y <= -6.2e+71) && ((y <= -1.95e+31) || !(y <= 9.5e-9))))
		tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a));
	else
		tmp = Float64(x / Float64(t - Float64(z * a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((y <= -3.65e+115) || (~((y <= -6.2e+71)) && ((y <= -1.95e+31) || ~((y <= 9.5e-9)))))
		tmp = -y / ((t / z) - a);
	else
		tmp = x / (t - (z * a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.65e+115], And[N[Not[LessEqual[y, -6.2e+71]], $MachinePrecision], Or[LessEqual[y, -1.95e+31], N[Not[LessEqual[y, 9.5e-9]], $MachinePrecision]]]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.65 \cdot 10^{+115} \lor \neg \left(y \leq -6.2 \cdot 10^{+71}\right) \land \left(y \leq -1.95 \cdot 10^{+31} \lor \neg \left(y \leq 9.5 \cdot 10^{-9}\right)\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.64999999999999984e115 or -6.20000000000000036e71 < y < -1.95e31 or 9.5000000000000007e-9 < y

    1. Initial program 74.6%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified74.6%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num74.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z \cdot a}{x - y \cdot z}}} \]
      2. inv-pow74.6%

        \[\leadsto \color{blue}{{\left(\frac{t - z \cdot a}{x - y \cdot z}\right)}^{-1}} \]
      3. sub-neg74.6%

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

        \[\leadsto {\left(\frac{\color{blue}{\left(-z \cdot a\right) + t}}{x - y \cdot z}\right)}^{-1} \]
      5. *-commutative74.6%

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

        \[\leadsto {\left(\frac{\color{blue}{a \cdot \left(-z\right)} + t}{x - y \cdot z}\right)}^{-1} \]
      7. fma-def74.6%

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

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(a, -z, t\right)}{x - y \cdot z}\right)}^{-1}} \]
    7. Taylor expanded in a around 0 70.3%

      \[\leadsto {\color{blue}{\left(-1 \cdot \frac{a \cdot z}{x - y \cdot z} + \frac{t}{x - y \cdot z}\right)}}^{-1} \]
    8. Step-by-step derivation
      1. +-commutative70.3%

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

        \[\leadsto {\left(\frac{t}{x - y \cdot z} + \color{blue}{\left(-\frac{a \cdot z}{x - y \cdot z}\right)}\right)}^{-1} \]
      3. unsub-neg70.3%

        \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a \cdot z}{x - y \cdot z}\right)}}^{-1} \]
      4. associate-/l*73.7%

        \[\leadsto {\left(\frac{t}{x - y \cdot z} - \color{blue}{\frac{a}{\frac{x - y \cdot z}{z}}}\right)}^{-1} \]
    9. Simplified73.7%

      \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a}{\frac{x - y \cdot z}{z}}\right)}}^{-1} \]
    10. Taylor expanded in y around -inf 72.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{\frac{t}{z} - a}} \]
    11. Step-by-step derivation
      1. associate-*r/72.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{\frac{t}{z} - a}} \]
      2. mul-1-neg72.1%

        \[\leadsto \frac{\color{blue}{-y}}{\frac{t}{z} - a} \]
    12. Simplified72.1%

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

    if -3.64999999999999984e115 < y < -6.20000000000000036e71 or -1.95e31 < y < 9.5000000000000007e-9

    1. Initial program 96.9%

      \[\frac{x - y \cdot z}{t - a \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative96.9%

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 83.3%

      \[\leadsto \color{blue}{\frac{x}{t - a \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative83.3%

        \[\leadsto \frac{x}{t - \color{blue}{z \cdot a}} \]
    7. Simplified83.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.65 \cdot 10^{+115} \lor \neg \left(y \leq -6.2 \cdot 10^{+71}\right) \land \left(y \leq -1.95 \cdot 10^{+31} \lor \neg \left(y \leq 9.5 \cdot 10^{-9}\right)\right):\\ \;\;\;\;\frac{-y}{\frac{t}{z} - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{+182}:\\
\;\;\;\;\frac{y}{a}\\

\mathbf{elif}\;z \leq -1 \cdot 10^{-73}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 10^{+80}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.02e182 or 1e80 < z

    1. Initial program 60.4%

      \[\frac{x - y \cdot z}{t - a \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative60.4%

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 73.9%

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

    if -1.02e182 < z < -9.99999999999999997e-74 or -1.50000000000000004e-111 < z < 1e80

    1. Initial program 96.5%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified96.5%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 72.3%

      \[\leadsto \color{blue}{\frac{x}{t - a \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative72.3%

        \[\leadsto \frac{x}{t - \color{blue}{z \cdot a}} \]
    7. Simplified72.3%

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

    if -9.99999999999999997e-74 < z < -1.50000000000000004e-111

    1. Initial program 99.4%

      \[\frac{x - y \cdot z}{t - a \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative99.4%

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 87.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.02 \cdot 10^{+182}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-73}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-111}:\\ \;\;\;\;\frac{x - z \cdot y}{t}\\ \mathbf{elif}\;z \leq 10^{+80}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 53.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+75}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-95}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+80}:\\ \;\;\;\;\frac{-x}{z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -6.6e+75)
   (/ y a)
   (if (<= z 1.05e-95)
     (/ x t)
     (if (<= z 1.05e+80) (/ (- x) (* z a)) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6.6e+75) {
		tmp = y / a;
	} else if (z <= 1.05e-95) {
		tmp = x / t;
	} else if (z <= 1.05e+80) {
		tmp = -x / (z * a);
	} else {
		tmp = y / a;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z <= (-6.6d+75)) then
        tmp = y / a
    else if (z <= 1.05d-95) then
        tmp = x / t
    else if (z <= 1.05d+80) then
        tmp = -x / (z * a)
    else
        tmp = y / a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6.6e+75) {
		tmp = y / a;
	} else if (z <= 1.05e-95) {
		tmp = x / t;
	} else if (z <= 1.05e+80) {
		tmp = -x / (z * a);
	} else {
		tmp = y / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -6.6e+75:
		tmp = y / a
	elif z <= 1.05e-95:
		tmp = x / t
	elif z <= 1.05e+80:
		tmp = -x / (z * a)
	else:
		tmp = y / a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -6.6e+75)
		tmp = Float64(y / a);
	elseif (z <= 1.05e-95)
		tmp = Float64(x / t);
	elseif (z <= 1.05e+80)
		tmp = Float64(Float64(-x) / Float64(z * a));
	else
		tmp = Float64(y / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -6.6e+75)
		tmp = y / a;
	elseif (z <= 1.05e-95)
		tmp = x / t;
	elseif (z <= 1.05e+80)
		tmp = -x / (z * a);
	else
		tmp = y / a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.6e+75], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.05e-95], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.05e+80], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+75}:\\
\;\;\;\;\frac{y}{a}\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{-95}:\\
\;\;\;\;\frac{x}{t}\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{+80}:\\
\;\;\;\;\frac{-x}{z \cdot a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.59999999999999996e75 or 1.05000000000000001e80 < z

    1. Initial program 67.5%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified67.5%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 65.9%

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

    if -6.59999999999999996e75 < z < 1.05e-95

    1. Initial program 98.3%

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

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 56.6%

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

    if 1.05e-95 < z < 1.05000000000000001e80

    1. Initial program 96.3%

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

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num96.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z \cdot a}{x - y \cdot z}}} \]
      2. inv-pow96.0%

        \[\leadsto \color{blue}{{\left(\frac{t - z \cdot a}{x - y \cdot z}\right)}^{-1}} \]
      3. sub-neg96.0%

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

        \[\leadsto {\left(\frac{\color{blue}{\left(-z \cdot a\right) + t}}{x - y \cdot z}\right)}^{-1} \]
      5. *-commutative96.0%

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(a, -z, t\right)}{x - y \cdot z}\right)}^{-1}} \]
    7. Taylor expanded in a around 0 92.3%

      \[\leadsto {\color{blue}{\left(-1 \cdot \frac{a \cdot z}{x - y \cdot z} + \frac{t}{x - y \cdot z}\right)}}^{-1} \]
    8. Step-by-step derivation
      1. +-commutative92.3%

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

        \[\leadsto {\left(\frac{t}{x - y \cdot z} + \color{blue}{\left(-\frac{a \cdot z}{x - y \cdot z}\right)}\right)}^{-1} \]
      3. unsub-neg92.3%

        \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a \cdot z}{x - y \cdot z}\right)}}^{-1} \]
      4. associate-/l*88.7%

        \[\leadsto {\left(\frac{t}{x - y \cdot z} - \color{blue}{\frac{a}{\frac{x - y \cdot z}{z}}}\right)}^{-1} \]
    9. Simplified88.7%

      \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a}{\frac{x - y \cdot z}{z}}\right)}}^{-1} \]
    10. Taylor expanded in y around 0 64.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{t}{x} - \frac{a \cdot z}{x}}} \]
    11. Step-by-step derivation
      1. *-commutative64.2%

        \[\leadsto \frac{1}{\frac{t}{x} - \frac{\color{blue}{z \cdot a}}{x}} \]
    12. Simplified64.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{t}{x} - \frac{z \cdot a}{x}}} \]
    13. Taylor expanded in t around 0 45.4%

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

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

        \[\leadsto \frac{\color{blue}{-x}}{a \cdot z} \]
      3. *-commutative45.4%

        \[\leadsto \frac{-x}{\color{blue}{z \cdot a}} \]
    15. Simplified45.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+75}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-95}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+80}:\\ \;\;\;\;\frac{-x}{z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 91.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\ \;\;\;\;\frac{-y}{\frac{t}{z} - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -3.3e+182) (not (<= z 4.5e+182)))
   (/ (- y) (- (/ t z) a))
   (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -3.3e+182) || !(z <= 4.5e+182)) {
		tmp = -y / ((t / z) - a);
	} else {
		tmp = (x - (z * y)) / (t - (z * a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-3.3d+182)) .or. (.not. (z <= 4.5d+182))) then
        tmp = -y / ((t / z) - a)
    else
        tmp = (x - (z * y)) / (t - (z * a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -3.3e+182) || !(z <= 4.5e+182)) {
		tmp = -y / ((t / z) - a);
	} else {
		tmp = (x - (z * y)) / (t - (z * a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -3.3e+182) or not (z <= 4.5e+182):
		tmp = -y / ((t / z) - a)
	else:
		tmp = (x - (z * y)) / (t - (z * a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -3.3e+182) || !(z <= 4.5e+182))
		tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a));
	else
		tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -3.3e+182) || ~((z <= 4.5e+182)))
		tmp = -y / ((t / z) - a);
	else
		tmp = (x - (z * y)) / (t - (z * a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.3e+182], N[Not[LessEqual[z, 4.5e+182]], $MachinePrecision]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.3000000000000001e182 or 4.50000000000000029e182 < z

    1. Initial program 49.5%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified49.5%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num49.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z \cdot a}{x - y \cdot z}}} \]
      2. inv-pow49.5%

        \[\leadsto \color{blue}{{\left(\frac{t - z \cdot a}{x - y \cdot z}\right)}^{-1}} \]
      3. sub-neg49.5%

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

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

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

        \[\leadsto {\left(\frac{\color{blue}{a \cdot \left(-z\right)} + t}{x - y \cdot z}\right)}^{-1} \]
      7. fma-def49.5%

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

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(a, -z, t\right)}{x - y \cdot z}\right)}^{-1}} \]
    7. Taylor expanded in a around 0 43.4%

      \[\leadsto {\color{blue}{\left(-1 \cdot \frac{a \cdot z}{x - y \cdot z} + \frac{t}{x - y \cdot z}\right)}}^{-1} \]
    8. Step-by-step derivation
      1. +-commutative43.4%

        \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} + -1 \cdot \frac{a \cdot z}{x - y \cdot z}\right)}}^{-1} \]
      2. mul-1-neg43.4%

        \[\leadsto {\left(\frac{t}{x - y \cdot z} + \color{blue}{\left(-\frac{a \cdot z}{x - y \cdot z}\right)}\right)}^{-1} \]
      3. unsub-neg43.4%

        \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a \cdot z}{x - y \cdot z}\right)}}^{-1} \]
      4. associate-/l*55.2%

        \[\leadsto {\left(\frac{t}{x - y \cdot z} - \color{blue}{\frac{a}{\frac{x - y \cdot z}{z}}}\right)}^{-1} \]
    9. Simplified55.2%

      \[\leadsto {\color{blue}{\left(\frac{t}{x - y \cdot z} - \frac{a}{\frac{x - y \cdot z}{z}}\right)}}^{-1} \]
    10. Taylor expanded in y around -inf 91.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{\frac{t}{z} - a}} \]
    11. Step-by-step derivation
      1. associate-*r/91.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{\frac{t}{z} - a}} \]
      2. mul-1-neg91.6%

        \[\leadsto \frac{\color{blue}{-y}}{\frac{t}{z} - a} \]
    12. Simplified91.6%

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

    if -3.3000000000000001e182 < z < 4.50000000000000029e182

    1. Initial program 95.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\ \;\;\;\;\frac{-y}{\frac{t}{z} - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 63.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.02 \cdot 10^{+182} \lor \neg \left(z \leq 7 \cdot 10^{+79}\right):\\ \;\;\;\;\frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -1.02e+182) (not (<= z 7e+79))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -1.02e+182) || !(z <= 7e+79)) {
		tmp = y / a;
	} else {
		tmp = x / (t - (z * a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-1.02d+182)) .or. (.not. (z <= 7d+79))) then
        tmp = y / a
    else
        tmp = x / (t - (z * a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -1.02e+182) || !(z <= 7e+79)) {
		tmp = y / a;
	} else {
		tmp = x / (t - (z * a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -1.02e+182) or not (z <= 7e+79):
		tmp = y / a
	else:
		tmp = x / (t - (z * a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -1.02e+182) || !(z <= 7e+79))
		tmp = Float64(y / a);
	else
		tmp = Float64(x / Float64(t - Float64(z * a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -1.02e+182) || ~((z <= 7e+79)))
		tmp = y / a;
	else
		tmp = x / (t - (z * a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.02e+182], N[Not[LessEqual[z, 7e+79]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+182} \lor \neg \left(z \leq 7 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.02e182 or 6.99999999999999961e79 < z

    1. Initial program 60.4%

      \[\frac{x - y \cdot z}{t - a \cdot z} \]
    2. Step-by-step derivation
      1. *-commutative60.4%

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 73.9%

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

    if -1.02e182 < z < 6.99999999999999961e79

    1. Initial program 96.6%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified96.6%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 70.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.02 \cdot 10^{+182} \lor \neg \left(z \leq 7 \cdot 10^{+79}\right):\\ \;\;\;\;\frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 53.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+75} \lor \neg \left(z \leq 8 \cdot 10^{+79}\right):\\ \;\;\;\;\frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= z -6.6e+75) (not (<= z 8e+79))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -6.6e+75) || !(z <= 8e+79)) {
		tmp = y / a;
	} else {
		tmp = x / t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((z <= (-6.6d+75)) .or. (.not. (z <= 8d+79))) then
        tmp = y / a
    else
        tmp = x / t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -6.6e+75) || !(z <= 8e+79)) {
		tmp = y / a;
	} else {
		tmp = x / t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -6.6e+75) or not (z <= 8e+79):
		tmp = y / a
	else:
		tmp = x / t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -6.6e+75) || !(z <= 8e+79))
		tmp = Float64(y / a);
	else
		tmp = Float64(x / t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z <= -6.6e+75) || ~((z <= 8e+79)))
		tmp = y / a;
	else
		tmp = x / t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.6e+75], N[Not[LessEqual[z, 8e+79]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+75} \lor \neg \left(z \leq 8 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.59999999999999996e75 or 7.99999999999999974e79 < z

    1. Initial program 67.5%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified67.5%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 65.9%

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

    if -6.59999999999999996e75 < z < 7.99999999999999974e79

    1. Initial program 98.0%

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

        \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
    3. Simplified98.0%

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 51.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+75} \lor \neg \left(z \leq 8 \cdot 10^{+79}\right):\\ \;\;\;\;\frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 34.9% accurate, 3.7× speedup?

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

\\
\frac{x}{t}
\end{array}
Derivation
  1. Initial program 86.6%

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

      \[\leadsto \frac{x - y \cdot z}{t - \color{blue}{z \cdot a}} \]
  3. Simplified86.6%

    \[\leadsto \color{blue}{\frac{x - y \cdot z}{t - z \cdot a}} \]
  4. Add Preprocessing
  5. Taylor expanded in z around 0 38.7%

    \[\leadsto \color{blue}{\frac{x}{t}} \]
  6. Final simplification38.7%

    \[\leadsto \frac{x}{t} \]
  7. Add Preprocessing

Developer target: 97.3% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t_1}\\

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


\end{array}
\end{array}

Reproduce

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

  :herbie-target
  (if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))

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