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

Percentage Accurate: 85.4% → 91.4%
Time: 10.8s
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.4% 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.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+147} \lor \neg \left(z \leq 8.2 \cdot 10^{+123}\right):\\ \;\;\;\;\frac{y - \frac{x}{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 -2.8e+147) (not (<= z 8.2e+123)))
   (/ (- y (/ x z)) a)
   (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -2.8e+147) || !(z <= 8.2e+123)) {
		tmp = (y - (x / 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 <= (-2.8d+147)) .or. (.not. (z <= 8.2d+123))) then
        tmp = (y - (x / 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 <= -2.8e+147) || !(z <= 8.2e+123)) {
		tmp = (y - (x / z)) / a;
	} else {
		tmp = (x - (z * y)) / (t - (z * a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -2.8e+147) or not (z <= 8.2e+123):
		tmp = (y - (x / z)) / a
	else:
		tmp = (x - (z * y)) / (t - (z * a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -2.8e+147) || !(z <= 8.2e+123))
		tmp = Float64(Float64(y - Float64(x / 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 <= -2.8e+147) || ~((z <= 8.2e+123)))
		tmp = (y - (x / 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, -2.8e+147], N[Not[LessEqual[z, 8.2e+123]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $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 -2.8 \cdot 10^{+147} \lor \neg \left(z \leq 8.2 \cdot 10^{+123}\right):\\
\;\;\;\;\frac{y - \frac{x}{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 < -2.8000000000000001e147 or 8.19999999999999979e123 < z

    1. Initial program 58.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y + -1 \cdot \frac{x}{z}}{a}} \]
    8. Step-by-step derivation
      1. mul-1-neg86.1%

        \[\leadsto \frac{y + \color{blue}{\left(-\frac{x}{z}\right)}}{a} \]
      2. sub-neg86.1%

        \[\leadsto \frac{\color{blue}{y - \frac{x}{z}}}{a} \]
    9. Simplified86.1%

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

    if -2.8000000000000001e147 < z < 8.19999999999999979e123

    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.2%

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

Alternative 2: 64.0% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -1.9 \cdot 10^{-140}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 7.5 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.8000000000000001e147 or 7.4999999999999999e123 < z

    1. Initial program 58.1%

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

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

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

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

    if -1.8000000000000001e147 < z < -1.89999999999999999e-140 or 3.0999999999999999e-58 < z < 7.4999999999999999e123

    1. Initial program 93.9%

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

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

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. *-commutative62.8%

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

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

    if -1.89999999999999999e-140 < z < 3.0999999999999999e-58

    1. Initial program 99.8%

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

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

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

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

Alternative 3: 55.1% accurate, 0.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.12e17 or 5.90000000000000029e63 < z

    1. Initial program 70.4%

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

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

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

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

    if -1.12e17 < z < 1.94999999999999992e-8

    1. Initial program 99.8%

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

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

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

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

    if 1.94999999999999992e-8 < z < 5.90000000000000029e63

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{y \cdot z}{t - a \cdot z}} \]
      2. associate-/l*81.1%

        \[\leadsto -\color{blue}{y \cdot \frac{z}{t - a \cdot z}} \]
      3. distribute-rgt-neg-in81.1%

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-\frac{z}{\color{blue}{\mathsf{fma}\left(a, -z, t\right)}}\right) \]
      10. distribute-neg-frac281.1%

        \[\leadsto y \cdot \color{blue}{\frac{z}{-\mathsf{fma}\left(a, -z, t\right)}} \]
      11. neg-sub081.1%

        \[\leadsto y \cdot \frac{z}{\color{blue}{0 - \mathsf{fma}\left(a, -z, t\right)}} \]
      12. fma-undefine81.1%

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

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

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

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

        \[\leadsto y \cdot \frac{z}{\color{blue}{\left(0 - z \cdot \left(-a\right)\right) - t}} \]
      17. neg-sub081.1%

        \[\leadsto y \cdot \frac{z}{\color{blue}{\left(-z \cdot \left(-a\right)\right)} - t} \]
      18. distribute-rgt-neg-out81.1%

        \[\leadsto y \cdot \frac{z}{\left(-\color{blue}{\left(-z \cdot a\right)}\right) - t} \]
      19. remove-double-neg81.1%

        \[\leadsto y \cdot \frac{z}{\color{blue}{z \cdot a} - t} \]
      20. *-commutative81.1%

        \[\leadsto y \cdot \frac{z}{\color{blue}{a \cdot z} - t} \]
    7. Simplified81.1%

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{-z}}{t} \]
    10. Simplified61.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{+17}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{+63}:\\ \;\;\;\;y \cdot \frac{z}{-t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 69.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.2 \cdot 10^{+18} \lor \neg \left(a \leq 6 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.2e18 or 6.00000000000000023e-26 < a

    1. Initial program 82.3%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y + -1 \cdot \frac{x}{z}}{a}} \]
    8. Step-by-step derivation
      1. mul-1-neg71.8%

        \[\leadsto \frac{y + \color{blue}{\left(-\frac{x}{z}\right)}}{a} \]
      2. sub-neg71.8%

        \[\leadsto \frac{\color{blue}{y - \frac{x}{z}}}{a} \]
    9. Simplified71.8%

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

    if -4.2e18 < a < 6.00000000000000023e-26

    1. Initial program 92.4%

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

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

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. *-commutative80.9%

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

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

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

Alternative 5: 65.5% accurate, 0.6× speedup?

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

    1. Initial program 65.1%

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

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

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

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

    if -8.8000000000000005e74 < z < 7.4999999999999999e123

    1. Initial program 98.1%

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

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

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

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

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

Alternative 6: 69.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6 \cdot 10^{+17}:\\
\;\;\;\;\frac{y + x \cdot \frac{-1}{z}}{a}\\

\mathbf{elif}\;a \leq 1.35 \cdot 10^{-26}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -4.6e17

    1. Initial program 79.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y + -1 \cdot \frac{x}{z}}{a}} \]
    8. Step-by-step derivation
      1. mul-1-neg77.4%

        \[\leadsto \frac{y + \color{blue}{\left(-\frac{x}{z}\right)}}{a} \]
      2. sub-neg77.4%

        \[\leadsto \frac{\color{blue}{y - \frac{x}{z}}}{a} \]
    9. Simplified77.4%

      \[\leadsto \color{blue}{\frac{y - \frac{x}{z}}{a}} \]
    10. Step-by-step derivation
      1. div-inv77.4%

        \[\leadsto \frac{y - \color{blue}{x \cdot \frac{1}{z}}}{a} \]
    11. Applied egg-rr77.4%

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

    if -4.6e17 < a < 1.34999999999999991e-26

    1. Initial program 92.4%

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

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

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

      \[\leadsto \color{blue}{\frac{x - y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. *-commutative80.9%

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

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

    if 1.34999999999999991e-26 < a

    1. Initial program 85.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y + -1 \cdot \frac{x}{z}}{a}} \]
    8. Step-by-step derivation
      1. mul-1-neg67.0%

        \[\leadsto \frac{y + \color{blue}{\left(-\frac{x}{z}\right)}}{a} \]
      2. sub-neg67.0%

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

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

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

Alternative 7: 54.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+16} \lor \neg \left(z \leq 1.55 \cdot 10^{+53}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.55e16 or 1.5500000000000001e53 < z

    1. Initial program 71.7%

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

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

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

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

    if -1.55e16 < z < 1.5500000000000001e53

    1. Initial program 99.8%

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

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

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

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

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

Alternative 8: 35.2% 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 87.3%

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

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

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

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

Developer Target 1: 97.1% 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 2024147 
(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))))