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

Percentage Accurate: 85.5% → 90.2%
Time: 12.4s
Alternatives: 9
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 85.5% 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: 90.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{+82} \lor \neg \left(z \leq 1.55 \cdot 10^{+174}\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 -7.8e+82) (not (<= z 1.55e+174)))
   (/ (- 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 <= -7.8e+82) || !(z <= 1.55e+174)) {
		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 <= (-7.8d+82)) .or. (.not. (z <= 1.55d+174))) 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 <= -7.8e+82) || !(z <= 1.55e+174)) {
		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 <= -7.8e+82) or not (z <= 1.55e+174):
		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 <= -7.8e+82) || !(z <= 1.55e+174))
		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 <= -7.8e+82) || ~((z <= 1.55e+174)))
		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, -7.8e+82], N[Not[LessEqual[z, 1.55e+174]], $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 -7.8 \cdot 10^{+82} \lor \neg \left(z \leq 1.55 \cdot 10^{+174}\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 < -7.79999999999999951e82 or 1.55e174 < z

    1. Initial program 50.2%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(x - y \cdot z\right)}}{a \cdot z} \]
      3. sub-neg44.2%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot z - x}}{a \cdot z} \]
      10. *-commutative44.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{y \cdot z - x}{z}}{a}} \]
      2. div-inv61.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{\frac{y}{a} \cdot 1} \]
      5. *-commutative87.9%

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{1 \cdot \frac{y}{a}} \]
      6. metadata-eval87.9%

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{\left(--1\right)} \cdot \frac{y}{a} \]
      7. cancel-sign-sub-inv87.9%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{x}{z} - -1 \cdot y}{a}} \]
      10. cancel-sign-sub-inv87.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \frac{x}{z} + \left(--1\right) \cdot y}}{a} \]
      11. metadata-eval87.9%

        \[\leadsto \frac{-1 \cdot \frac{x}{z} + \color{blue}{1} \cdot y}{a} \]
      12. *-lft-identity87.9%

        \[\leadsto \frac{-1 \cdot \frac{x}{z} + \color{blue}{y}}{a} \]
      13. +-commutative87.9%

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

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

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

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

    if -7.79999999999999951e82 < z < 1.55e174

    1. Initial program 96.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{+82} \lor \neg \left(z \leq 1.55 \cdot 10^{+174}\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: 71.9% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;z \leq 3.4 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{t_2}\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{+62}:\\
\;\;\;\;z \cdot \frac{-y}{t_2}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.10000000000000011e-32 or 1.05e62 < z

    1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot z - x}}{a \cdot z} \]
      10. *-commutative50.4%

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot z - x}{z} \cdot \frac{1}{a}} \]
      3. *-commutative64.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{a \cdot z} + \frac{y}{a}} \]
    11. Step-by-step derivation
      1. *-commutative80.3%

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

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

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

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{\frac{y}{a} \cdot 1} \]
      5. *-commutative83.6%

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{1 \cdot \frac{y}{a}} \]
      6. metadata-eval83.6%

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{\left(--1\right)} \cdot \frac{y}{a} \]
      7. cancel-sign-sub-inv83.6%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{x}{z} - -1 \cdot y}{a}} \]
      10. cancel-sign-sub-inv83.6%

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

        \[\leadsto \frac{-1 \cdot \frac{x}{z} + \color{blue}{1} \cdot y}{a} \]
      12. *-lft-identity83.6%

        \[\leadsto \frac{-1 \cdot \frac{x}{z} + \color{blue}{y}}{a} \]
      13. +-commutative83.6%

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

        \[\leadsto \frac{y + \color{blue}{\left(-\frac{x}{z}\right)}}{a} \]
      15. unsub-neg83.6%

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

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

    if -3.10000000000000011e-32 < z < 2.2999999999999999e-283

    1. Initial program 99.9%

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

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

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

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

    if 2.2999999999999999e-283 < z < 3.4e16

    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 76.2%

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

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

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

    if 3.4e16 < z < 1.05e62

    1. Initial program 84.7%

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{y}{\frac{t - a \cdot z}{z}}} \]
      3. associate-/r/74.0%

        \[\leadsto -\color{blue}{\frac{y}{t - a \cdot z} \cdot z} \]
      4. sub-neg74.0%

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

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

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

        \[\leadsto -\frac{y}{\color{blue}{\mathsf{fma}\left(a, -z, t\right)}} \cdot z \]
      8. distribute-rgt-neg-in74.0%

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

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

        \[\leadsto \frac{y}{\color{blue}{\left(-a \cdot z\right)} + t} \cdot \left(-z\right) \]
      11. +-commutative74.0%

        \[\leadsto \frac{y}{\color{blue}{t + \left(-a \cdot z\right)}} \cdot \left(-z\right) \]
      12. sub-neg74.0%

        \[\leadsto \frac{y}{\color{blue}{t - a \cdot z}} \cdot \left(-z\right) \]
      13. *-commutative74.0%

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

      \[\leadsto \color{blue}{\frac{y}{t - z \cdot a} \cdot \left(-z\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification82.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{-32}:\\ \;\;\;\;\frac{y - \frac{x}{z}}{a}\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-283}:\\ \;\;\;\;\frac{x - z \cdot y}{t}\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+16}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+62}:\\ \;\;\;\;z \cdot \frac{-y}{t - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - \frac{x}{z}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x - z \cdot y}{t}\\ t_2 := \frac{y - \frac{x}{z}}{a}\\ \mathbf{if}\;z \leq -1.12 \cdot 10^{-32}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 10^{-286}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-127}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-17}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (- x (* z y)) t)) (t_2 (/ (- y (/ x z)) a)))
   (if (<= z -1.12e-32)
     t_2
     (if (<= z 1e-286)
       t_1
       (if (<= z 4.5e-127)
         (/ x (- t (* z a)))
         (if (<= z 1.55e-17) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x - (z * y)) / t;
	double t_2 = (y - (x / z)) / a;
	double tmp;
	if (z <= -1.12e-32) {
		tmp = t_2;
	} else if (z <= 1e-286) {
		tmp = t_1;
	} else if (z <= 4.5e-127) {
		tmp = x / (t - (z * a));
	} else if (z <= 1.55e-17) {
		tmp = 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 = (x - (z * y)) / t
    t_2 = (y - (x / z)) / a
    if (z <= (-1.12d-32)) then
        tmp = t_2
    else if (z <= 1d-286) then
        tmp = t_1
    else if (z <= 4.5d-127) then
        tmp = x / (t - (z * a))
    else if (z <= 1.55d-17) then
        tmp = 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 = (x - (z * y)) / t;
	double t_2 = (y - (x / z)) / a;
	double tmp;
	if (z <= -1.12e-32) {
		tmp = t_2;
	} else if (z <= 1e-286) {
		tmp = t_1;
	} else if (z <= 4.5e-127) {
		tmp = x / (t - (z * a));
	} else if (z <= 1.55e-17) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (x - (z * y)) / t
	t_2 = (y - (x / z)) / a
	tmp = 0
	if z <= -1.12e-32:
		tmp = t_2
	elif z <= 1e-286:
		tmp = t_1
	elif z <= 4.5e-127:
		tmp = x / (t - (z * a))
	elif z <= 1.55e-17:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x - Float64(z * y)) / t)
	t_2 = Float64(Float64(y - Float64(x / z)) / a)
	tmp = 0.0
	if (z <= -1.12e-32)
		tmp = t_2;
	elseif (z <= 1e-286)
		tmp = t_1;
	elseif (z <= 4.5e-127)
		tmp = Float64(x / Float64(t - Float64(z * a)));
	elseif (z <= 1.55e-17)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x - (z * y)) / t;
	t_2 = (y - (x / z)) / a;
	tmp = 0.0;
	if (z <= -1.12e-32)
		tmp = t_2;
	elseif (z <= 1e-286)
		tmp = t_1;
	elseif (z <= 4.5e-127)
		tmp = x / (t - (z * a));
	elseif (z <= 1.55e-17)
		tmp = t_1;
	else
		tmp = t_2;
	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]}, Block[{t$95$2 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -1.12e-32], t$95$2, If[LessEqual[z, 1e-286], t$95$1, If[LessEqual[z, 4.5e-127], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-17], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 10^{-286}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 1.55 \cdot 10^{-17}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.12e-32 or 1.5499999999999999e-17 < z

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot z - x}}{a \cdot z} \]
      10. *-commutative50.3%

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

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

        \[\leadsto \color{blue}{\frac{\frac{y \cdot z - x}{z}}{a}} \]
      2. div-inv63.4%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{a \cdot z} + \frac{y}{a}} \]
    11. Step-by-step derivation
      1. *-commutative76.7%

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

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

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

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{\frac{y}{a} \cdot 1} \]
      5. *-commutative79.6%

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{1 \cdot \frac{y}{a}} \]
      6. metadata-eval79.6%

        \[\leadsto \frac{-1 \cdot \frac{x}{z}}{a} + \color{blue}{\left(--1\right)} \cdot \frac{y}{a} \]
      7. cancel-sign-sub-inv79.6%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{x}{z} - -1 \cdot y}{a}} \]
      10. cancel-sign-sub-inv79.6%

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

        \[\leadsto \frac{-1 \cdot \frac{x}{z} + \color{blue}{1} \cdot y}{a} \]
      12. *-lft-identity79.6%

        \[\leadsto \frac{-1 \cdot \frac{x}{z} + \color{blue}{y}}{a} \]
      13. +-commutative79.6%

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

        \[\leadsto \frac{y + \color{blue}{\left(-\frac{x}{z}\right)}}{a} \]
      15. unsub-neg79.6%

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

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

    if -1.12e-32 < z < 1.00000000000000005e-286 or 4.4999999999999999e-127 < z < 1.5499999999999999e-17

    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 t around inf 80.7%

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

    if 1.00000000000000005e-286 < z < 4.4999999999999999e-127

    1. Initial program 99.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{-32}:\\ \;\;\;\;\frac{y - \frac{x}{z}}{a}\\ \mathbf{elif}\;z \leq 10^{-286}:\\ \;\;\;\;\frac{x - z \cdot y}{t}\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-127}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-17}:\\ \;\;\;\;\frac{x - z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - \frac{x}{z}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 54.1% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 3.3 \cdot 10^{-80}:\\
\;\;\;\;y \cdot \frac{z}{-t}\\

\mathbf{elif}\;z \leq 62000000000000:\\
\;\;\;\;\frac{x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.15000000000000001e-51 or 6.2e13 < z

    1. Initial program 65.4%

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

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

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

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

    if -1.15000000000000001e-51 < z < 4.30000000000000019e-122 or 3.3e-80 < z < 6.2e13

    1. Initial program 99.9%

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

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

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

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

    if 4.30000000000000019e-122 < z < 3.3e-80

    1. Initial program 99.5%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-y \cdot z}}{t} \]
      3. *-commutative55.1%

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

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

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

        \[\leadsto \color{blue}{\frac{-z \cdot \left(-y\right)}{-t}} \]
      2. div-inv55.2%

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

        \[\leadsto \left(-\color{blue}{\left(-z \cdot y\right)}\right) \cdot \frac{1}{-t} \]
      4. remove-double-neg55.2%

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

        \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \frac{1}{-t} \]
    10. Applied egg-rr55.2%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{z \cdot 1}{-t}} \]
      3. *-rgt-identity49.9%

        \[\leadsto y \cdot \frac{\color{blue}{z}}{-t} \]
    12. Simplified49.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{-51}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-122}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-80}:\\ \;\;\;\;y \cdot \frac{z}{-t}\\ \mathbf{elif}\;z \leq 62000000000000:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 54.3% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 3.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{z \cdot \left(-y\right)}{t}\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.5499999999999999e-51 or 1.9e16 < z

    1. Initial program 65.4%

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

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

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

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

    if -2.5499999999999999e-51 < z < 8.99999999999999959e-122 or 3.3e-80 < z < 1.9e16

    1. Initial program 99.9%

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

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

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

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

    if 8.99999999999999959e-122 < z < 3.3e-80

    1. Initial program 99.5%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-y \cdot z}}{t} \]
      3. *-commutative55.1%

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

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

      \[\leadsto \color{blue}{\frac{z \cdot \left(-y\right)}{t}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.55 \cdot 10^{-51}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-122}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-80}:\\ \;\;\;\;\frac{z \cdot \left(-y\right)}{t}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+16}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 64.0% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 9200000000:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.99999999999999977e-7 or 9.2e9 < z

    1. Initial program 62.9%

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

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

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

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

    if -4.99999999999999977e-7 < z < 2.7999999999999999e-282

    1. Initial program 99.9%

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

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

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

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

    if 2.7999999999999999e-282 < z < 9.2e9

    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 76.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-7}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-282}:\\ \;\;\;\;\frac{x - z \cdot y}{t}\\ \mathbf{elif}\;z \leq 9200000000:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 64.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{-5} \lor \neg \left(z \leq 5.8 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.09999999999999996e-5 or 5.8e17 < z

    1. Initial program 62.6%

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

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

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

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

    if -5.09999999999999996e-5 < z < 5.8e17

    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 73.5%

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

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

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

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

Alternative 8: 55.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.50000000000000002e-51 or 7.8e12 < z

    1. Initial program 65.4%

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

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

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

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

    if -2.50000000000000002e-51 < z < 7.8e12

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

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

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

Alternative 9: 35.8% 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 82.1%

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

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

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

    \[\leadsto \color{blue}{\frac{x}{t}} \]
  6. Final simplification33.4%

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

Developer target: 97.5% 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 2024011 
(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))))