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

Percentage Accurate: 84.8% → 97.6%
Time: 10.8s
Alternatives: 10
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 10 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 97.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t - z \cdot a\\ t_2 := \frac{x - y \cdot z}{t\_1}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;y \cdot \left(\frac{z}{z \cdot a - t} + \frac{x}{y \cdot t\_1}\right)\\ \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-313}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;\frac{-1}{z \cdot \frac{\frac{t}{z} - a}{y \cdot z - x}}\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+297}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - \frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- t (* z a))) (t_2 (/ (- x (* y z)) t_1)))
   (if (<= t_2 (- INFINITY))
     (* y (+ (/ z (- (* z a) t)) (/ x (* y t_1))))
     (if (<= t_2 -1e-313)
       t_2
       (if (<= t_2 0.0)
         (/ -1.0 (* z (/ (- (/ t z) a) (- (* y z) x))))
         (if (<= t_2 2e+297) t_2 (/ y (- a (/ t z)))))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = t - (z * a);
	double t_2 = (x - (y * z)) / t_1;
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1)));
	} else if (t_2 <= -1e-313) {
		tmp = t_2;
	} else if (t_2 <= 0.0) {
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
	} else if (t_2 <= 2e+297) {
		tmp = t_2;
	} else {
		tmp = y / (a - (t / z));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = t - (z * a);
	double t_2 = (x - (y * z)) / t_1;
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1)));
	} else if (t_2 <= -1e-313) {
		tmp = t_2;
	} else if (t_2 <= 0.0) {
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
	} else if (t_2 <= 2e+297) {
		tmp = t_2;
	} else {
		tmp = y / (a - (t / z));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = t - (z * a)
	t_2 = (x - (y * z)) / t_1
	tmp = 0
	if t_2 <= -math.inf:
		tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1)))
	elif t_2 <= -1e-313:
		tmp = t_2
	elif t_2 <= 0.0:
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)))
	elif t_2 <= 2e+297:
		tmp = t_2
	else:
		tmp = y / (a - (t / z))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(t - Float64(z * a))
	t_2 = Float64(Float64(x - Float64(y * z)) / t_1)
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(y * Float64(Float64(z / Float64(Float64(z * a) - t)) + Float64(x / Float64(y * t_1))));
	elseif (t_2 <= -1e-313)
		tmp = t_2;
	elseif (t_2 <= 0.0)
		tmp = Float64(-1.0 / Float64(z * Float64(Float64(Float64(t / z) - a) / Float64(Float64(y * z) - x))));
	elseif (t_2 <= 2e+297)
		tmp = t_2;
	else
		tmp = Float64(y / Float64(a - Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = t - (z * a);
	t_2 = (x - (y * z)) / t_1;
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1)));
	elseif (t_2 <= -1e-313)
		tmp = t_2;
	elseif (t_2 <= 0.0)
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
	elseif (t_2 <= 2e+297)
		tmp = t_2;
	else
		tmp = y / (a - (t / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(y * N[(N[(z / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-313], t$95$2, If[LessEqual[t$95$2, 0.0], N[(-1.0 / N[(z * N[(N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+297], t$95$2, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \frac{x - y \cdot z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{z}{z \cdot a - t} + \frac{x}{y \cdot t\_1}\right)\\

\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0

    1. Initial program 55.7%

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

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

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

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

    if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.00000000001e-313 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2e297

    1. Initial program 99.7%

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

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

    1. Initial program 53.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2e297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z)))

    1. Initial program 27.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -\infty:\\ \;\;\;\;y \cdot \left(\frac{z}{z \cdot a - t} + \frac{x}{y \cdot \left(t - z \cdot a\right)}\right)\\ \mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -1 \cdot 10^{-313}:\\ \;\;\;\;\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{\frac{t}{z} - a}{y \cdot z - x}}\\ \mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 2 \cdot 10^{+297}:\\ \;\;\;\;\frac{x - y \cdot z}{t - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - \frac{t}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 94.9% 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 -1 \cdot 10^{-313}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\frac{-1}{z \cdot \frac{\frac{t}{z} - a}{y \cdot z - x}}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+297}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - \frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
   (if (<= t_1 -1e-313)
     t_1
     (if (<= t_1 0.0)
       (/ -1.0 (* z (/ (- (/ t z) a) (- (* y z) x))))
       (if (<= t_1 2e+297) t_1 (/ y (- a (/ t z))))))))
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 <= -1e-313) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
	} else if (t_1 <= 2e+297) {
		tmp = t_1;
	} else {
		tmp = y / (a - (t / z));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x - (y * z)) / (t - (z * a))
    if (t_1 <= (-1d-313)) then
        tmp = t_1
    else if (t_1 <= 0.0d0) then
        tmp = (-1.0d0) / (z * (((t / z) - a) / ((y * z) - x)))
    else if (t_1 <= 2d+297) then
        tmp = t_1
    else
        tmp = y / (a - (t / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x - (y * z)) / (t - (z * a));
	double tmp;
	if (t_1 <= -1e-313) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
	} else if (t_1 <= 2e+297) {
		tmp = t_1;
	} else {
		tmp = y / (a - (t / z));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (x - (y * z)) / (t - (z * a))
	tmp = 0
	if t_1 <= -1e-313:
		tmp = t_1
	elif t_1 <= 0.0:
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)))
	elif t_1 <= 2e+297:
		tmp = t_1
	else:
		tmp = y / (a - (t / z))
	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 <= -1e-313)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = Float64(-1.0 / Float64(z * Float64(Float64(Float64(t / z) - a) / Float64(Float64(y * z) - x))));
	elseif (t_1 <= 2e+297)
		tmp = t_1;
	else
		tmp = Float64(y / Float64(a - Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x - (y * z)) / (t - (z * a));
	tmp = 0.0;
	if (t_1 <= -1e-313)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
	elseif (t_1 <= 2e+297)
		tmp = t_1;
	else
		tmp = y / (a - (t / z));
	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, -1e-313], t$95$1, If[LessEqual[t$95$1, 0.0], N[(-1.0 / N[(z * N[(N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+297], t$95$1, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 96.5%

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

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

    1. Initial program 53.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2e297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z)))

    1. Initial program 27.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq -1 \cdot 10^{-313}:\\ \;\;\;\;\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{\frac{t}{z} - a}{y \cdot z - x}}\\ \mathbf{elif}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 2 \cdot 10^{+297}:\\ \;\;\;\;\frac{x - y \cdot z}{t - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - \frac{t}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 91.8% 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 -1 \cdot 10^{-313}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{t}{z} - a}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+297}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - \frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
   (if (<= t_1 -1e-313)
     t_1
     (if (<= t_1 0.0)
       (/ (/ x z) (- (/ t z) a))
       (if (<= t_1 2e+297) t_1 (/ y (- a (/ t z))))))))
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 <= -1e-313) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = (x / z) / ((t / z) - a);
	} else if (t_1 <= 2e+297) {
		tmp = t_1;
	} else {
		tmp = y / (a - (t / z));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x - (y * z)) / (t - (z * a))
    if (t_1 <= (-1d-313)) then
        tmp = t_1
    else if (t_1 <= 0.0d0) then
        tmp = (x / z) / ((t / z) - a)
    else if (t_1 <= 2d+297) then
        tmp = t_1
    else
        tmp = y / (a - (t / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x - (y * z)) / (t - (z * a));
	double tmp;
	if (t_1 <= -1e-313) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = (x / z) / ((t / z) - a);
	} else if (t_1 <= 2e+297) {
		tmp = t_1;
	} else {
		tmp = y / (a - (t / z));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (x - (y * z)) / (t - (z * a))
	tmp = 0
	if t_1 <= -1e-313:
		tmp = t_1
	elif t_1 <= 0.0:
		tmp = (x / z) / ((t / z) - a)
	elif t_1 <= 2e+297:
		tmp = t_1
	else:
		tmp = y / (a - (t / z))
	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 <= -1e-313)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = Float64(Float64(x / z) / Float64(Float64(t / z) - a));
	elseif (t_1 <= 2e+297)
		tmp = t_1;
	else
		tmp = Float64(y / Float64(a - Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x - (y * z)) / (t - (z * a));
	tmp = 0.0;
	if (t_1 <= -1e-313)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = (x / z) / ((t / z) - a);
	elseif (t_1 <= 2e+297)
		tmp = t_1;
	else
		tmp = y / (a - (t / z));
	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, -1e-313], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(x / z), $MachinePrecision] / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+297], t$95$1, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{t}{z} - a}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 96.5%

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

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

    1. Initial program 53.8%

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

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

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

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

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

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

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

    if 2e297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z)))

    1. Initial program 27.1%

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

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

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

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

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

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

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

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

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

Alternative 4: 53.7% accurate, 0.5× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.32e61 or 1.3399999999999999e101 < z

    1. Initial program 58.2%

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

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

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

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

    if -2.32e61 < z < 6.20000000000000013e-115

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

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

    if 6.20000000000000013e-115 < z < 1.3399999999999999e101

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\frac{-1}{a}}{z}} \]
    13. Simplified37.1%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\frac{--1}{-a}}}{z} \]
      3. metadata-eval41.1%

        \[\leadsto \frac{x \cdot \frac{\color{blue}{1}}{-a}}{z} \]
      4. un-div-inv41.2%

        \[\leadsto \frac{\color{blue}{\frac{x}{-a}}}{z} \]
    15. Applied egg-rr41.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.32 \cdot 10^{+61}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-115}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{elif}\;z \leq 1.34 \cdot 10^{+101}:\\ \;\;\;\;\frac{\frac{-x}{a}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 52.9% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 2.15 \cdot 10^{+135}:\\
\;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.7000000000000002e61 or 2.14999999999999986e135 < z

    1. Initial program 57.5%

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

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

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

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

    if -2.7000000000000002e61 < z < 1.1e-115

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

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

    if 1.1e-115 < z < 2.14999999999999986e135

    1. Initial program 90.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{y}{x} - \frac{1}{z}}{a}} \]
    11. Taylor expanded in x around inf 37.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{+61}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-115}:\\ \;\;\;\;\frac{x}{t}\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+135}:\\ \;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 70.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-45} \lor \neg \left(x \leq 9.8 \cdot 10^{+22}\right):\\
\;\;\;\;\frac{x}{t - z \cdot a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.50000000000000005e-45 or 9.79999999999999958e22 < x

    1. Initial program 85.3%

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

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

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

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

    if -1.50000000000000005e-45 < x < 9.79999999999999958e22

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

Alternative 7: 62.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+83} \lor \neg \left(y \leq 6.2 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x - y \cdot z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.1000000000000001e83 or 6.19999999999999982e-30 < y

    1. Initial program 77.1%

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

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

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

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

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

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

    if -4.1000000000000001e83 < y < 6.19999999999999982e-30

    1. Initial program 92.9%

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

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

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

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

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

Alternative 8: 65.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+78} \lor \neg \left(z \leq 3.2 \cdot 10^{+136}\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.8e+78) (not (<= z 3.2e+136))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -5.8e+78) || !(z <= 3.2e+136)) {
		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.8d+78)) .or. (.not. (z <= 3.2d+136))) 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.8e+78) || !(z <= 3.2e+136)) {
		tmp = y / a;
	} else {
		tmp = x / (t - (z * a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -5.8e+78) or not (z <= 3.2e+136):
		tmp = y / a
	else:
		tmp = x / (t - (z * a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -5.8e+78) || !(z <= 3.2e+136))
		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.8e+78) || ~((z <= 3.2e+136)))
		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.8e+78], N[Not[LessEqual[z, 3.2e+136]], $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.8 \cdot 10^{+78} \lor \neg \left(z \leq 3.2 \cdot 10^{+136}\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.80000000000000034e78 or 3.19999999999999988e136 < z

    1. Initial program 56.3%

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

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

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

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

    if -5.80000000000000034e78 < z < 3.19999999999999988e136

    1. Initial program 96.6%

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

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

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

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

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

Alternative 9: 53.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+62} \lor \neg \left(z \leq 6.9 \cdot 10^{-115}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.00000000000000014e62 or 6.89999999999999999e-115 < z

    1. Initial program 72.5%

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

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

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

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

    if -4.00000000000000014e62 < z < 6.89999999999999999e-115

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

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

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

Alternative 10: 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 85.6%

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

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

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

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

Developer Target 1: 97.4% accurate, 0.4× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))

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