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

Percentage Accurate: 84.9% → 91.2%
Time: 11.4s
Alternatives: 9
Speedup: 0.2×

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: 84.9% 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.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{-297}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\frac{1}{z} \cdot \frac{y \cdot z - x}{a}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
   (if (<= t_1 -2e-297)
     t_1
     (if (<= t_1 0.0)
       (* (/ 1.0 z) (/ (- (* y z) x) a))
       (if (<= t_1 INFINITY) t_1 (/ y a))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x - (y * z)) / (t - (z * a));
	double tmp;
	if (t_1 <= -2e-297) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = (1.0 / z) * (((y * z) - x) / a);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = y / a;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x - (y * z)) / (t - (z * a));
	double tmp;
	if (t_1 <= -2e-297) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = (1.0 / z) * (((y * z) - x) / a);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = y / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (x - (y * z)) / (t - (z * a))
	tmp = 0
	if t_1 <= -2e-297:
		tmp = t_1
	elif t_1 <= 0.0:
		tmp = (1.0 / z) * (((y * z) - x) / a)
	elif t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = y / a
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a)))
	tmp = 0.0
	if (t_1 <= -2e-297)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = Float64(Float64(1.0 / z) * Float64(Float64(Float64(y * z) - x) / a));
	elseif (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(y / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x - (y * z)) / (t - (z * a));
	tmp = 0.0;
	if (t_1 <= -2e-297)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = (1.0 / z) * (((y * z) - x) / a);
	elseif (t_1 <= Inf)
		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[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-297], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{1}{z} \cdot \frac{y \cdot z - x}{a}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -2.00000000000000008e-297 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0

    1. Initial program 94.1%

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

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

    1. Initial program 51.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x - y \cdot z}{a \cdot z}} \]
    5. Step-by-step derivation
      1. *-commutative23.8%

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

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

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

        \[\leadsto \frac{\color{blue}{0 - \left(x - y \cdot z\right)}}{z \cdot a} \]
      5. sub-neg23.8%

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

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

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(-y \cdot z\right)}\right) - x}{z \cdot a} \]
      11. remove-double-neg23.8%

        \[\leadsto \frac{\color{blue}{y \cdot z} - x}{z \cdot a} \]
    6. Simplified23.8%

      \[\leadsto \color{blue}{\frac{y \cdot z - x}{z \cdot a}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity23.8%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(y \cdot z - x\right)}}{z \cdot a} \]
      2. times-frac78.4%

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

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

    if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z)))

    1. Initial program 0.0%

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

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

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

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

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

Alternative 2: 63.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-41} \lor \neg \left(t \leq 2.5 \cdot 10^{+36}\right):\\
\;\;\;\;\frac{x - y \cdot z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.10000000000000013e-41 or 2.49999999999999988e36 < t

    1. Initial program 86.8%

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

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

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

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

    if -2.10000000000000013e-41 < t < 2.49999999999999988e36

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot z - x}{z \cdot a}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity66.9%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(y \cdot z - x\right)}}{z \cdot a} \]
      2. times-frac73.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{-41} \lor \neg \left(t \leq 2.5 \cdot 10^{+36}\right):\\ \;\;\;\;\frac{x - y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{y \cdot z - x}{a}\\ \end{array} \]

Alternative 3: 64.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.76:\\
\;\;\;\;\frac{y}{a}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.76000000000000001 or 5.8e14 < z

    1. Initial program 70.8%

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

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

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

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

    if -0.76000000000000001 < z < -3.2000000000000001e-55

    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. Taylor expanded in x around inf 78.2%

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

        \[\leadsto \frac{x}{t - \color{blue}{z \cdot a}} \]
    6. Simplified78.2%

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

    if -3.2000000000000001e-55 < z < 5.8e14

    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. Taylor expanded in t around inf 77.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.76:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-55}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+14}:\\ \;\;\;\;\frac{x - y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]

Alternative 4: 65.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{-6} \lor \neg \left(y \leq 7.5 \cdot 10^{+39}\right):\\
\;\;\;\;z \cdot \frac{y}{z \cdot a - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.59999999999999984e-6 or 7.5000000000000005e39 < y

    1. Initial program 77.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y \cdot z\right)}{t - a \cdot z}} \]
      2. associate-*r*57.1%

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot y\right) \cdot z}}{t - a \cdot z} \]
      3. neg-mul-157.1%

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

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

      \[\leadsto \color{blue}{\frac{\left(-y\right) \cdot z}{t - z \cdot a}} \]
    7. Step-by-step derivation
      1. frac-2neg57.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(y \cdot \frac{1}{\left(-t\right) + z \cdot a}\right)} \]
      2. associate-*r/65.7%

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

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

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

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

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

    if -3.59999999999999984e-6 < y < 7.5000000000000005e39

    1. Initial program 94.3%

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

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

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

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

        \[\leadsto \frac{x}{t - \color{blue}{z \cdot a}} \]
    6. Simplified76.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{-6} \lor \neg \left(y \leq 7.5 \cdot 10^{+39}\right):\\ \;\;\;\;z \cdot \frac{y}{z \cdot a - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \end{array} \]

Alternative 5: 65.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;y \leq -0.000175:\\
\;\;\;\;\frac{-z}{\frac{t_1}{y}}\\

\mathbf{elif}\;y \leq 3.1 \cdot 10^{+38}:\\
\;\;\;\;\frac{x}{t_1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.74999999999999998e-4

    1. Initial program 81.2%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(-z\right)}}{t - a \cdot z} \]
      4. *-commutative56.6%

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

        \[\leadsto \frac{\left(-z\right) \cdot y}{t - \color{blue}{z \cdot a}} \]
      6. associate-/l*63.6%

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

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

    if -1.74999999999999998e-4 < y < 3.10000000000000018e38

    1. Initial program 94.3%

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

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

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

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

        \[\leadsto \frac{x}{t - \color{blue}{z \cdot a}} \]
    6. Simplified76.2%

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

    if 3.10000000000000018e38 < y

    1. Initial program 73.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y \cdot z\right)}{t - a \cdot z}} \]
      2. associate-*r*57.7%

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot y\right) \cdot z}}{t - a \cdot z} \]
      3. neg-mul-157.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-y\right) \cdot z}{t - z \cdot a}} \]
    7. Step-by-step derivation
      1. frac-2neg57.7%

        \[\leadsto \color{blue}{\frac{-\left(-y\right) \cdot z}{-\left(t - z \cdot a\right)}} \]
      2. distribute-lft-neg-out57.7%

        \[\leadsto \frac{-\color{blue}{\left(-y \cdot z\right)}}{-\left(t - z \cdot a\right)} \]
      3. remove-double-neg57.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(y \cdot \frac{1}{\left(-t\right) + z \cdot a}\right)} \]
      2. associate-*r/67.9%

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

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

        \[\leadsto z \cdot \frac{y}{\color{blue}{z \cdot a + \left(-t\right)}} \]
      5. unsub-neg67.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.000175:\\ \;\;\;\;\frac{-z}{\frac{t - z \cdot a}{y}}\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{+38}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z \cdot a - t}\\ \end{array} \]

Alternative 6: 54.9% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;z \leq -2.9 \cdot 10^{-105} \lor \neg \left(z \leq 1.22 \cdot 10^{+14}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.4e-8 or -2.10000000000000009e-100 < z < -2.90000000000000003e-105 or 1.22e14 < z

    1. Initial program 71.9%

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

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

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

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

    if -3.4e-8 < z < -2.10000000000000009e-100

    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. Taylor expanded in t around 0 51.5%

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(x - y \cdot z\right)}}{z \cdot a} \]
      4. neg-sub051.5%

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

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

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

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(-y \cdot z\right)}\right) - x}{z \cdot a} \]
      11. remove-double-neg51.5%

        \[\leadsto \frac{\color{blue}{y \cdot z} - x}{z \cdot a} \]
    6. Simplified51.5%

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

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

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot a} \]
    9. Simplified43.6%

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

    if -2.90000000000000003e-105 < z < 1.22e14

    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. Taylor expanded in z around 0 60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-100}:\\ \;\;\;\;\frac{-x}{z \cdot a}\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{-105} \lor \neg \left(z \leq 1.22 \cdot 10^{+14}\right):\\ \;\;\;\;\frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t}\\ \end{array} \]

Alternative 7: 64.9% accurate, 1.0× speedup?

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

    1. Initial program 69.8%

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

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

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

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

    if -0.80000000000000004 < z < 1.99999999999999989e66

    1. Initial program 97.2%

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

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

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

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

        \[\leadsto \frac{x}{t - \color{blue}{z \cdot a}} \]
    6. Simplified69.2%

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

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

Alternative 8: 54.6% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-105} \lor \neg \left(z \leq 68000000000000\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.90000000000000003e-105 or 6.8e13 < z

    1. Initial program 74.4%

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

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

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

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

    if -2.90000000000000003e-105 < z < 6.8e13

    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. Taylor expanded in z around 0 60.2%

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

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

Alternative 9: 35.6% 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 85.5%

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

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

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

    \[\leadsto \color{blue}{\frac{x}{t}} \]
  5. Final simplification32.7%

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

Developer target: 97.1% accurate, 0.6× 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 2023301 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
  :precision binary64

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

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