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

Percentage Accurate: 85.4% → 91.2%
Time: 12.3s
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: 85.4% accurate, 1.0× speedup?

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

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

Alternative 1: 91.2% accurate, 0.2× speedup?

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

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 97.7%

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

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

    1. Initial program 51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\frac{1}{a} - \frac{x}{a \cdot \left(y \cdot z\right)}\right)} \]
      4. associate-/r*70.9%

        \[\leadsto y \cdot \left(\frac{1}{a} - \color{blue}{\frac{\frac{x}{a}}{y \cdot z}}\right) \]
    13. Simplified70.9%

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

    if 5.0000000000000004e301 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z)))

    1. Initial program 40.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{a} + -1 \cdot \frac{x}{a \cdot z}} \]
      2. mul-1-neg93.0%

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

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

        \[\leadsto \frac{y}{a} - \frac{x}{\color{blue}{z \cdot a}} \]
    10. Simplified93.0%

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

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

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

        \[\leadsto \frac{y}{a} - \color{blue}{\frac{\frac{x}{z}}{a}} \]
      3. div-sub96.6%

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

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

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

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

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 97.7%

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

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

    1. Initial program 51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{a} - \frac{\color{blue}{1 \cdot x}}{z \cdot a} \]
      2. times-frac70.8%

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

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

    if 5.0000000000000004e301 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z)))

    1. Initial program 40.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{a} + -1 \cdot \frac{x}{a \cdot z}} \]
      2. mul-1-neg93.0%

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

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

        \[\leadsto \frac{y}{a} - \frac{x}{\color{blue}{z \cdot a}} \]
    10. Simplified93.0%

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

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

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

        \[\leadsto \frac{y}{a} - \color{blue}{\frac{\frac{x}{z}}{a}} \]
      3. div-sub96.6%

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

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

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

Alternative 3: 53.4% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq -1.32 \cdot 10^{-83} \lor \neg \left(z \leq 4.4 \cdot 10^{+52}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.20000000000000026e57 or -1.1000000000000001e-7 < z < -1.31999999999999994e-83 or 4.4e52 < z

    1. Initial program 68.3%

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

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

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

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

    if -6.20000000000000026e57 < z < -1.1000000000000001e-7

    1. Initial program 99.3%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-\frac{z}{t}\right)} \]
      4. distribute-neg-frac241.7%

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

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

    if -1.31999999999999994e-83 < z < 4.4e52

    1. Initial program 99.0%

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

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

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

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

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

Alternative 4: 53.5% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq -1.3 \cdot 10^{-81} \lor \neg \left(z \leq 5.3 \cdot 10^{+51}\right):\\
\;\;\;\;\frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.49999999999999989e55 or -2.59999999999999999e-7 < z < -1.2999999999999999e-81 or 5.2999999999999997e51 < z

    1. Initial program 68.3%

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

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

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

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

    if -9.49999999999999989e55 < z < -2.59999999999999999e-7

    1. Initial program 99.3%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-y \cdot z}}{t} \]
      2. distribute-rgt-neg-out41.9%

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

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

    if -1.2999999999999999e-81 < z < 5.2999999999999997e51

    1. Initial program 99.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+55}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-7}:\\ \;\;\;\;\frac{y \cdot z}{-t}\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-81} \lor \neg \left(z \leq 5.3 \cdot 10^{+51}\right):\\ \;\;\;\;\frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 65.2% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 6 \cdot 10^{+82}:\\
\;\;\;\;\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 < -1.35000000000000005e56 or 5.99999999999999978e82 < z

    1. Initial program 60.6%

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

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

      \[\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 -1.35000000000000005e56 < z < -1.4599999999999999e-230

    1. Initial program 99.6%

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

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

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

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

    if -1.4599999999999999e-230 < z < 5.99999999999999978e82

    1. Initial program 98.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+56}:\\ \;\;\;\;\frac{y}{a}\\ \mathbf{elif}\;z \leq -1.46 \cdot 10^{-230}:\\ \;\;\;\;\frac{x - y \cdot z}{t}\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+82}:\\ \;\;\;\;\frac{x}{t - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 70.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.35000000000000005e40 or 7.8e26 < a

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{a} - \frac{\color{blue}{1 \cdot x}}{z \cdot a} \]
      2. times-frac73.9%

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

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

    if -1.35000000000000005e40 < a < 7.8e26

    1. Initial program 95.6%

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

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

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

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

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

Alternative 7: 65.4% accurate, 0.6× speedup?

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

    1. Initial program 60.6%

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

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

      \[\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 -2.89999999999999991e59 < z < 1.06e86

    1. Initial program 99.1%

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

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

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

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

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

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

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

Alternative 8: 69.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{+45} \lor \neg \left(a \leq 4.7 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -8.20000000000000025e45 or 4.6999999999999998e25 < a

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{a} - \color{blue}{\frac{\frac{x}{z}}{a}} \]
      3. div-sub68.9%

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

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

    if -8.20000000000000025e45 < a < 4.6999999999999998e25

    1. Initial program 95.6%

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

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

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

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

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

Alternative 9: 53.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.34999999999999995e-81 or 5.2999999999999997e51 < z

    1. Initial program 73.3%

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

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

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

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

    if -1.34999999999999995e-81 < z < 5.2999999999999997e51

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{t}} \]
  6. Final simplification34.2%

    \[\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 2024071 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
  :precision binary64

  :alt
  (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))))