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

Percentage Accurate: 85.8% → 94.2%
Time: 11.4s
Alternatives: 9
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 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: 85.8% 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: 94.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - y \cdot z\\ t_2 := \frac{t\_1}{t - z \cdot a}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-290}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;\frac{t\_1}{z} \cdot \frac{1}{\frac{t}{z} - a}\\ \mathbf{elif}\;t\_2 \leq 10^{+269}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - \frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- x (* y z))) (t_2 (/ t_1 (- t (* z a)))))
   (if (<= t_2 -5e-290)
     t_2
     (if (<= t_2 0.0)
       (* (/ t_1 z) (/ 1.0 (- (/ t z) a)))
       (if (<= t_2 1e+269) t_2 (/ y (- a (/ t z))))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x - (y * z);
	double t_2 = t_1 / (t - (z * a));
	double tmp;
	if (t_2 <= -5e-290) {
		tmp = t_2;
	} else if (t_2 <= 0.0) {
		tmp = (t_1 / z) * (1.0 / ((t / z) - a));
	} else if (t_2 <= 1e+269) {
		tmp = t_2;
	} else {
		tmp = y / (a - (t / z));
	}
	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 = x - (y * z)
    t_2 = t_1 / (t - (z * a))
    if (t_2 <= (-5d-290)) then
        tmp = t_2
    else if (t_2 <= 0.0d0) then
        tmp = (t_1 / z) * (1.0d0 / ((t / z) - a))
    else if (t_2 <= 1d+269) then
        tmp = t_2
    else
        tmp = y / (a - (t / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x - (y * z);
	double t_2 = t_1 / (t - (z * a));
	double tmp;
	if (t_2 <= -5e-290) {
		tmp = t_2;
	} else if (t_2 <= 0.0) {
		tmp = (t_1 / z) * (1.0 / ((t / z) - a));
	} else if (t_2 <= 1e+269) {
		tmp = t_2;
	} else {
		tmp = y / (a - (t / z));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x - (y * z)
	t_2 = t_1 / (t - (z * a))
	tmp = 0
	if t_2 <= -5e-290:
		tmp = t_2
	elif t_2 <= 0.0:
		tmp = (t_1 / z) * (1.0 / ((t / z) - a))
	elif t_2 <= 1e+269:
		tmp = t_2
	else:
		tmp = y / (a - (t / z))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x - Float64(y * z))
	t_2 = Float64(t_1 / Float64(t - Float64(z * a)))
	tmp = 0.0
	if (t_2 <= -5e-290)
		tmp = t_2;
	elseif (t_2 <= 0.0)
		tmp = Float64(Float64(t_1 / z) * Float64(1.0 / Float64(Float64(t / z) - a)));
	elseif (t_2 <= 1e+269)
		tmp = t_2;
	else
		tmp = Float64(y / Float64(a - Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x - (y * z);
	t_2 = t_1 / (t - (z * a));
	tmp = 0.0;
	if (t_2 <= -5e-290)
		tmp = t_2;
	elseif (t_2 <= 0.0)
		tmp = (t_1 / z) * (1.0 / ((t / z) - a));
	elseif (t_2 <= 1e+269)
		tmp = t_2;
	else
		tmp = y / (a - (t / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-290], t$95$2, If[LessEqual[t$95$2, 0.0], N[(N[(t$95$1 / z), $MachinePrecision] * N[(1.0 / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+269], t$95$2, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - y \cdot z\\
t_2 := \frac{t\_1}{t - z \cdot a}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-290}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{t\_1}{z} \cdot \frac{1}{\frac{t}{z} - a}\\

\mathbf{elif}\;t\_2 \leq 10^{+269}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -5.0000000000000001e-290 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 1e269

    1. Initial program 97.8%

      \[\frac{x - y \cdot z}{t - a \cdot z} \]
    2. Add Preprocessing

    if -5.0000000000000001e-290 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0

    1. Initial program 54.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y \cdot z}{z}}{\frac{t}{z} - a}} \]
      2. div-inv99.8%

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

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

    if 1e269 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z)))

    1. Initial program 36.4%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{\frac{t}{z} - a}} \]
    7. Step-by-step derivation
      1. mul-1-neg83.1%

        \[\leadsto \color{blue}{-\frac{y}{\frac{t}{z} - a}} \]
      2. distribute-neg-frac283.1%

        \[\leadsto \color{blue}{\frac{y}{-\left(\frac{t}{z} - a\right)}} \]
      3. sub-neg83.1%

        \[\leadsto \frac{y}{-\color{blue}{\left(\frac{t}{z} + \left(-a\right)\right)}} \]
      4. +-commutative83.1%

        \[\leadsto \frac{y}{-\color{blue}{\left(\left(-a\right) + \frac{t}{z}\right)}} \]
      5. distribute-neg-in83.1%

        \[\leadsto \frac{y}{\color{blue}{\left(-\left(-a\right)\right) + \left(-\frac{t}{z}\right)}} \]
      6. remove-double-neg83.1%

        \[\leadsto \frac{y}{\color{blue}{a} + \left(-\frac{t}{z}\right)} \]
      7. unsub-neg83.1%

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

      \[\leadsto \color{blue}{\frac{y}{a - \frac{t}{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification96.9%

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

Alternative 2: 70.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{a - \frac{t}{z}}\\ \mathbf{if}\;z \leq -1.45 \cdot 10^{+116}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-14}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{elif}\;z \leq 2.45 \cdot 10^{-11}:\\ \;\;\;\;\frac{x - y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ y (- a (/ t z)))))
   (if (<= z -1.45e+116)
     t_1
     (if (<= z -4.2e-14)
       (/ x (- t (* z a)))
       (if (<= z 2.45e-11) (/ (- x (* y z)) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = y / (a - (t / z));
	double tmp;
	if (z <= -1.45e+116) {
		tmp = t_1;
	} else if (z <= -4.2e-14) {
		tmp = x / (t - (z * a));
	} else if (z <= 2.45e-11) {
		tmp = (x - (y * z)) / t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y / (a - (t / z))
    if (z <= (-1.45d+116)) then
        tmp = t_1
    else if (z <= (-4.2d-14)) then
        tmp = x / (t - (z * a))
    else if (z <= 2.45d-11) 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 a) {
	double t_1 = y / (a - (t / z));
	double tmp;
	if (z <= -1.45e+116) {
		tmp = t_1;
	} else if (z <= -4.2e-14) {
		tmp = x / (t - (z * a));
	} else if (z <= 2.45e-11) {
		tmp = (x - (y * z)) / t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = y / (a - (t / z))
	tmp = 0
	if z <= -1.45e+116:
		tmp = t_1
	elif z <= -4.2e-14:
		tmp = x / (t - (z * a))
	elif z <= 2.45e-11:
		tmp = (x - (y * z)) / t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(y / Float64(a - Float64(t / z)))
	tmp = 0.0
	if (z <= -1.45e+116)
		tmp = t_1;
	elseif (z <= -4.2e-14)
		tmp = Float64(x / Float64(t - Float64(z * a)));
	elseif (z <= 2.45e-11)
		tmp = Float64(Float64(x - Float64(y * z)) / t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = y / (a - (t / z));
	tmp = 0.0;
	if (z <= -1.45e+116)
		tmp = t_1;
	elseif (z <= -4.2e-14)
		tmp = x / (t - (z * a));
	elseif (z <= 2.45e-11)
		tmp = (x - (y * z)) / t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e+116], t$95$1, If[LessEqual[z, -4.2e-14], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.45e-11], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -4.2 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.4500000000000001e116 or 2.4499999999999999e-11 < z

    1. Initial program 65.9%

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

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

      \[\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 \frac{x - y \cdot z}{\color{blue}{z \cdot \left(\frac{t}{z} - a\right)}} \]
    6. Taylor expanded in x around 0 77.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{\frac{t}{z} - a}} \]
    7. Step-by-step derivation
      1. mul-1-neg77.3%

        \[\leadsto \color{blue}{-\frac{y}{\frac{t}{z} - a}} \]
      2. distribute-neg-frac277.3%

        \[\leadsto \color{blue}{\frac{y}{-\left(\frac{t}{z} - a\right)}} \]
      3. sub-neg77.3%

        \[\leadsto \frac{y}{-\color{blue}{\left(\frac{t}{z} + \left(-a\right)\right)}} \]
      4. +-commutative77.3%

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

        \[\leadsto \frac{y}{\color{blue}{\left(-\left(-a\right)\right) + \left(-\frac{t}{z}\right)}} \]
      6. remove-double-neg77.3%

        \[\leadsto \frac{y}{\color{blue}{a} + \left(-\frac{t}{z}\right)} \]
      7. unsub-neg77.3%

        \[\leadsto \frac{y}{\color{blue}{a - \frac{t}{z}}} \]
    8. Simplified77.3%

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

    if -1.4500000000000001e116 < z < -4.1999999999999998e-14

    1. Initial program 95.9%

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

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

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

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

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

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

    if -4.1999999999999998e-14 < z < 2.4499999999999999e-11

    1. Initial program 99.9%

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

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

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

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

Alternative 3: 91.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+122} \lor \neg \left(z \leq 9.2 \cdot 10^{+165}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.2000000000000001e122 or 9.20000000000000063e165 < z

    1. Initial program 51.7%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{\frac{t}{z} - a}} \]
    7. Step-by-step derivation
      1. mul-1-neg87.7%

        \[\leadsto \color{blue}{-\frac{y}{\frac{t}{z} - a}} \]
      2. distribute-neg-frac287.7%

        \[\leadsto \color{blue}{\frac{y}{-\left(\frac{t}{z} - a\right)}} \]
      3. sub-neg87.7%

        \[\leadsto \frac{y}{-\color{blue}{\left(\frac{t}{z} + \left(-a\right)\right)}} \]
      4. +-commutative87.7%

        \[\leadsto \frac{y}{-\color{blue}{\left(\left(-a\right) + \frac{t}{z}\right)}} \]
      5. distribute-neg-in87.7%

        \[\leadsto \frac{y}{\color{blue}{\left(-\left(-a\right)\right) + \left(-\frac{t}{z}\right)}} \]
      6. remove-double-neg87.7%

        \[\leadsto \frac{y}{\color{blue}{a} + \left(-\frac{t}{z}\right)} \]
      7. unsub-neg87.7%

        \[\leadsto \frac{y}{\color{blue}{a - \frac{t}{z}}} \]
    8. Simplified87.7%

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

    if -1.2000000000000001e122 < z < 9.20000000000000063e165

    1. Initial program 96.8%

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

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

Alternative 4: 53.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{+109}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -8.4 \cdot 10^{-16}:\\ \;\;\;\;\frac{\frac{x}{a}}{-z}\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -3.4e+109)
   (/ y a)
   (if (<= z -8.4e-16)
     (/ (/ x a) (- z))
     (if (<= z 2.55e-11) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -3.4e+109) {
		tmp = y / a;
	} else if (z <= -8.4e-16) {
		tmp = (x / a) / -z;
	} else if (z <= 2.55e-11) {
		tmp = x / t;
	} 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 <= (-3.4d+109)) then
        tmp = y / a
    else if (z <= (-8.4d-16)) then
        tmp = (x / a) / -z
    else if (z <= 2.55d-11) then
        tmp = x / t
    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 <= -3.4e+109) {
		tmp = y / a;
	} else if (z <= -8.4e-16) {
		tmp = (x / a) / -z;
	} else if (z <= 2.55e-11) {
		tmp = x / t;
	} else {
		tmp = y / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z <= -3.4e+109:
		tmp = y / a
	elif z <= -8.4e-16:
		tmp = (x / a) / -z
	elif z <= 2.55e-11:
		tmp = x / t
	else:
		tmp = y / a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -3.4e+109)
		tmp = Float64(y / a);
	elseif (z <= -8.4e-16)
		tmp = Float64(Float64(x / a) / Float64(-z));
	elseif (z <= 2.55e-11)
		tmp = Float64(x / t);
	else
		tmp = Float64(y / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -3.4e+109)
		tmp = y / a;
	elseif (z <= -8.4e-16)
		tmp = (x / a) / -z;
	elseif (z <= 2.55e-11)
		tmp = x / t;
	else
		tmp = y / a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e+109], N[(y / a), $MachinePrecision], If[LessEqual[z, -8.4e-16], N[(N[(x / a), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, 2.55e-11], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -8.4 \cdot 10^{-16}:\\
\;\;\;\;\frac{\frac{x}{a}}{-z}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.40000000000000006e109 or 2.54999999999999992e-11 < z

    1. Initial program 66.2%

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

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

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

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

    if -3.40000000000000006e109 < z < -8.4000000000000004e-16

    1. Initial program 95.8%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(\frac{z}{z \cdot a - t} + \frac{x}{y \cdot \left(t - z \cdot a\right)}\right)} \]
      2. Taylor expanded in a around inf 47.8%

        \[\leadsto \color{blue}{\frac{y \cdot \left(1 + -1 \cdot \frac{x}{y \cdot z}\right)}{a}} \]
      3. Step-by-step derivation
        1. associate-/l*47.7%

          \[\leadsto \color{blue}{y \cdot \frac{1 + -1 \cdot \frac{x}{y \cdot z}}{a}} \]
        2. associate-*r/47.7%

          \[\leadsto y \cdot \frac{1 + \color{blue}{\frac{-1 \cdot x}{y \cdot z}}}{a} \]
        3. neg-mul-147.7%

          \[\leadsto y \cdot \frac{1 + \frac{\color{blue}{-x}}{y \cdot z}}{a} \]
        4. *-commutative47.7%

          \[\leadsto y \cdot \frac{1 + \frac{-x}{\color{blue}{z \cdot y}}}{a} \]
      4. Simplified47.7%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x}{a \cdot z}} \]
      6. Step-by-step derivation
        1. mul-1-neg49.5%

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

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

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

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

      if -8.4000000000000004e-16 < z < 2.54999999999999992e-11

      1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t}} \]
    7. Recombined 3 regimes into one program.
    8. Add Preprocessing

    Alternative 5: 53.5% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+108}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \end{array} \]
    (FPCore (x y z t a)
     :precision binary64
     (if (<= z -2.1e+108)
       (/ y a)
       (if (<= z -2.7e-12) (/ x (* z (- a))) (if (<= z 2.6e-11) (/ x t) (/ y a)))))
    double code(double x, double y, double z, double t, double a) {
    	double tmp;
    	if (z <= -2.1e+108) {
    		tmp = y / a;
    	} else if (z <= -2.7e-12) {
    		tmp = x / (z * -a);
    	} else if (z <= 2.6e-11) {
    		tmp = x / t;
    	} 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 <= (-2.1d+108)) then
            tmp = y / a
        else if (z <= (-2.7d-12)) then
            tmp = x / (z * -a)
        else if (z <= 2.6d-11) then
            tmp = x / t
        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 <= -2.1e+108) {
    		tmp = y / a;
    	} else if (z <= -2.7e-12) {
    		tmp = x / (z * -a);
    	} else if (z <= 2.6e-11) {
    		tmp = x / t;
    	} else {
    		tmp = y / a;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a):
    	tmp = 0
    	if z <= -2.1e+108:
    		tmp = y / a
    	elif z <= -2.7e-12:
    		tmp = x / (z * -a)
    	elif z <= 2.6e-11:
    		tmp = x / t
    	else:
    		tmp = y / a
    	return tmp
    
    function code(x, y, z, t, a)
    	tmp = 0.0
    	if (z <= -2.1e+108)
    		tmp = Float64(y / a);
    	elseif (z <= -2.7e-12)
    		tmp = Float64(x / Float64(z * Float64(-a)));
    	elseif (z <= 2.6e-11)
    		tmp = Float64(x / t);
    	else
    		tmp = Float64(y / a);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a)
    	tmp = 0.0;
    	if (z <= -2.1e+108)
    		tmp = y / a;
    	elseif (z <= -2.7e-12)
    		tmp = x / (z * -a);
    	elseif (z <= 2.6e-11)
    		tmp = x / t;
    	else
    		tmp = y / a;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+108], N[(y / a), $MachinePrecision], If[LessEqual[z, -2.7e-12], N[(x / N[(z * (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e-11], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -2.1 \cdot 10^{+108}:\\
    \;\;\;\;\frac{y}{a}\\
    
    \mathbf{elif}\;z \leq -2.7 \cdot 10^{-12}:\\
    \;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\
    
    \mathbf{elif}\;z \leq 2.6 \cdot 10^{-11}:\\
    \;\;\;\;\frac{x}{t}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{y}{a}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -2.1000000000000001e108 or 2.6000000000000001e-11 < z

      1. Initial program 66.2%

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

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

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

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

      if -2.1000000000000001e108 < z < -2.6999999999999998e-12

      1. Initial program 95.8%

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

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

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

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

          \[\leadsto \color{blue}{\frac{-1 \cdot \left(x - y \cdot z\right)}{a \cdot z}} \]
        2. neg-mul-159.9%

          \[\leadsto \frac{\color{blue}{-\left(x - y \cdot z\right)}}{a \cdot z} \]
        3. neg-sub059.9%

          \[\leadsto \frac{\color{blue}{0 - \left(x - y \cdot z\right)}}{a \cdot z} \]
        4. sub-neg59.9%

          \[\leadsto \frac{0 - \color{blue}{\left(x + \left(-y \cdot z\right)\right)}}{a \cdot z} \]
        5. distribute-rgt-neg-out59.9%

          \[\leadsto \frac{0 - \left(x + \color{blue}{y \cdot \left(-z\right)}\right)}{a \cdot z} \]
        6. +-commutative59.9%

          \[\leadsto \frac{0 - \color{blue}{\left(y \cdot \left(-z\right) + x\right)}}{a \cdot z} \]
        7. associate--r+59.9%

          \[\leadsto \frac{\color{blue}{\left(0 - y \cdot \left(-z\right)\right) - x}}{a \cdot z} \]
        8. neg-sub059.9%

          \[\leadsto \frac{\color{blue}{\left(-y \cdot \left(-z\right)\right)} - x}{a \cdot z} \]
        9. distribute-rgt-neg-out59.9%

          \[\leadsto \frac{\left(-\color{blue}{\left(-y \cdot z\right)}\right) - x}{a \cdot z} \]
        10. remove-double-neg59.9%

          \[\leadsto \frac{\color{blue}{y \cdot z} - x}{a \cdot z} \]
        11. *-commutative59.9%

          \[\leadsto \frac{y \cdot z - x}{\color{blue}{z \cdot a}} \]
      7. Simplified59.9%

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

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{z \cdot a} \]
      9. Step-by-step derivation
        1. neg-mul-149.5%

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

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

      if -2.6999999999999998e-12 < z < 2.6000000000000001e-11

      1. Initial program 99.9%

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+108}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 71.2% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{+117} \lor \neg \left(z \leq 1.02 \cdot 10^{-21}\right):\\ \;\;\;\;\frac{y}{a - \frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \end{array} \end{array} \]
    (FPCore (x y z t a)
     :precision binary64
     (if (or (<= z -7.2e+117) (not (<= z 1.02e-21)))
       (/ y (- a (/ t z)))
       (/ x (- t (* z a)))))
    double code(double x, double y, double z, double t, double a) {
    	double tmp;
    	if ((z <= -7.2e+117) || !(z <= 1.02e-21)) {
    		tmp = y / (a - (t / z));
    	} 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 <= (-7.2d+117)) .or. (.not. (z <= 1.02d-21))) then
            tmp = y / (a - (t / z))
        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 <= -7.2e+117) || !(z <= 1.02e-21)) {
    		tmp = y / (a - (t / z));
    	} else {
    		tmp = x / (t - (z * a));
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a):
    	tmp = 0
    	if (z <= -7.2e+117) or not (z <= 1.02e-21):
    		tmp = y / (a - (t / z))
    	else:
    		tmp = x / (t - (z * a))
    	return tmp
    
    function code(x, y, z, t, a)
    	tmp = 0.0
    	if ((z <= -7.2e+117) || !(z <= 1.02e-21))
    		tmp = Float64(y / Float64(a - Float64(t / z)));
    	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 <= -7.2e+117) || ~((z <= 1.02e-21)))
    		tmp = y / (a - (t / z));
    	else
    		tmp = x / (t - (z * a));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e+117], N[Not[LessEqual[z, 1.02e-21]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -7.2 \cdot 10^{+117} \lor \neg \left(z \leq 1.02 \cdot 10^{-21}\right):\\
    \;\;\;\;\frac{y}{a - \frac{t}{z}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x}{t - z \cdot a}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -7.20000000000000025e117 or 1.02000000000000004e-21 < z

      1. Initial program 67.1%

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{y}{\frac{t}{z} - a}} \]
      7. Step-by-step derivation
        1. mul-1-neg76.4%

          \[\leadsto \color{blue}{-\frac{y}{\frac{t}{z} - a}} \]
        2. distribute-neg-frac276.4%

          \[\leadsto \color{blue}{\frac{y}{-\left(\frac{t}{z} - a\right)}} \]
        3. sub-neg76.4%

          \[\leadsto \frac{y}{-\color{blue}{\left(\frac{t}{z} + \left(-a\right)\right)}} \]
        4. +-commutative76.4%

          \[\leadsto \frac{y}{-\color{blue}{\left(\left(-a\right) + \frac{t}{z}\right)}} \]
        5. distribute-neg-in76.4%

          \[\leadsto \frac{y}{\color{blue}{\left(-\left(-a\right)\right) + \left(-\frac{t}{z}\right)}} \]
        6. remove-double-neg76.4%

          \[\leadsto \frac{y}{\color{blue}{a} + \left(-\frac{t}{z}\right)} \]
        7. unsub-neg76.4%

          \[\leadsto \frac{y}{\color{blue}{a - \frac{t}{z}}} \]
      8. Simplified76.4%

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

      if -7.20000000000000025e117 < z < 1.02000000000000004e-21

      1. Initial program 99.2%

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

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

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

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

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

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

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

    Alternative 7: 64.5% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+118} \lor \neg \left(z \leq 1.8 \cdot 10^{+163}\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 -5.2e+118) (not (<= z 1.8e+163))) (/ y a) (/ x (- t (* z a)))))
    double code(double x, double y, double z, double t, double a) {
    	double tmp;
    	if ((z <= -5.2e+118) || !(z <= 1.8e+163)) {
    		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 <= (-5.2d+118)) .or. (.not. (z <= 1.8d+163))) 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 <= -5.2e+118) || !(z <= 1.8e+163)) {
    		tmp = y / a;
    	} else {
    		tmp = x / (t - (z * a));
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a):
    	tmp = 0
    	if (z <= -5.2e+118) or not (z <= 1.8e+163):
    		tmp = y / a
    	else:
    		tmp = x / (t - (z * a))
    	return tmp
    
    function code(x, y, z, t, a)
    	tmp = 0.0
    	if ((z <= -5.2e+118) || !(z <= 1.8e+163))
    		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 <= -5.2e+118) || ~((z <= 1.8e+163)))
    		tmp = y / a;
    	else
    		tmp = x / (t - (z * a));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.2e+118], N[Not[LessEqual[z, 1.8e+163]], $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 -5.2 \cdot 10^{+118} \lor \neg \left(z \leq 1.8 \cdot 10^{+163}\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 < -5.20000000000000032e118 or 1.79999999999999989e163 < z

      1. Initial program 51.7%

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

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

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

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

      if -5.20000000000000032e118 < z < 1.79999999999999989e163

      1. Initial program 96.8%

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

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

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

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

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

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

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

    Alternative 8: 54.3% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{+50} \lor \neg \left(z \leq 5.5 \cdot 10^{-16}\right):\\ \;\;\;\;\frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t}\\ \end{array} \end{array} \]
    (FPCore (x y z t a)
     :precision binary64
     (if (or (<= z -1.7e+50) (not (<= z 5.5e-16))) (/ y a) (/ x t)))
    double code(double x, double y, double z, double t, double a) {
    	double tmp;
    	if ((z <= -1.7e+50) || !(z <= 5.5e-16)) {
    		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 <= (-1.7d+50)) .or. (.not. (z <= 5.5d-16))) 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 <= -1.7e+50) || !(z <= 5.5e-16)) {
    		tmp = y / a;
    	} else {
    		tmp = x / t;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a):
    	tmp = 0
    	if (z <= -1.7e+50) or not (z <= 5.5e-16):
    		tmp = y / a
    	else:
    		tmp = x / t
    	return tmp
    
    function code(x, y, z, t, a)
    	tmp = 0.0
    	if ((z <= -1.7e+50) || !(z <= 5.5e-16))
    		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 <= -1.7e+50) || ~((z <= 5.5e-16)))
    		tmp = y / a;
    	else
    		tmp = x / t;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.7e+50], N[Not[LessEqual[z, 5.5e-16]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -1.7 \cdot 10^{+50} \lor \neg \left(z \leq 5.5 \cdot 10^{-16}\right):\\
    \;\;\;\;\frac{y}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x}{t}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -1.6999999999999999e50 or 5.49999999999999964e-16 < z

      1. Initial program 67.9%

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

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

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

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

      if -1.6999999999999999e50 < z < 5.49999999999999964e-16

      1. Initial program 99.9%

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

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

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

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

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

    Alternative 9: 35.4% 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 84.6%

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

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

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

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

    Developer Target 1: 97.4% 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 2024139 
    (FPCore (x y z t a)
      :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
      :precision binary64
    
      :alt
      (! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
    
      (/ (- x (* y z)) (- t (* a z))))