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

Percentage Accurate: 95.9% → 96.5%
Time: 8.7s
Alternatives: 8
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 95.9% accurate, 1.0× speedup?

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

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

Alternative 1: 96.5% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \leq 2.4 \cdot 10^{-22}:\\ \;\;\;\;\frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-z, \frac{t}{x\_m}, \frac{y}{x\_m}\right)}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= x_m 2.4e-22)
    (/ x_m (fma (- z) t y))
    (/ 1.0 (fma (- z) (/ t x_m) (/ y x_m))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (x_m <= 2.4e-22) {
		tmp = x_m / fma(-z, t, y);
	} else {
		tmp = 1.0 / fma(-z, (t / x_m), (y / x_m));
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (x_m <= 2.4e-22)
		tmp = Float64(x_m / fma(Float64(-z), t, y));
	else
		tmp = Float64(1.0 / fma(Float64(-z), Float64(t / x_m), Float64(y / x_m)));
	end
	return Float64(x_s * tmp)
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[x$95$m, 2.4e-22], N[(x$95$m / N[((-z) * t + y), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[((-z) * N[(t / x$95$m), $MachinePrecision] + N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 2.4 \cdot 10^{-22}:\\
\;\;\;\;\frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(-z, \frac{t}{x\_m}, \frac{y}{x\_m}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.40000000000000002e-22

    1. Initial program 97.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y - z \cdot t}} \]
      2. sub-negN/A

        \[\leadsto \frac{x}{\color{blue}{y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}} \]
      3. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + y}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x}{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + y} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + y} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), t, y\right)}} \]
      7. lower-neg.f6497.0

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{-z}, t, y\right)} \]
    4. Applied rewrites97.0%

      \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(-z, t, y\right)}} \]

    if 2.40000000000000002e-22 < x

    1. Initial program 96.6%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{y - z \cdot t}} \]
      2. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}} \]
      4. lower-/.f6496.6

        \[\leadsto \frac{1}{\color{blue}{\frac{y - z \cdot t}{x}}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{y - \color{blue}{z \cdot t}}{x}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{y - \color{blue}{t \cdot z}}{x}} \]
      7. lower-*.f6496.6

        \[\leadsto \frac{1}{\frac{y - \color{blue}{t \cdot z}}{x}} \]
    4. Applied rewrites96.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{y - t \cdot z}{x}}} \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{1}{\frac{\color{blue}{y - t \cdot z}}{x}} \]
      2. sub-negN/A

        \[\leadsto \frac{1}{\frac{\color{blue}{y + \left(\mathsf{neg}\left(t \cdot z\right)\right)}}{x}} \]
      3. remove-double-negN/A

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} + \left(\mathsf{neg}\left(t \cdot z\right)\right)}{x}} \]
      4. distribute-neg-inN/A

        \[\leadsto \frac{1}{\frac{\color{blue}{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(y\right)\right) + t \cdot z\right)\right)}}{x}} \]
      5. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{\mathsf{neg}\left(\color{blue}{\left(t \cdot z + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{x}} \]
      6. sub-negN/A

        \[\leadsto \frac{1}{\frac{\mathsf{neg}\left(\color{blue}{\left(t \cdot z - y\right)}\right)}{x}} \]
      7. lift--.f64N/A

        \[\leadsto \frac{1}{\frac{\mathsf{neg}\left(\color{blue}{\left(t \cdot z - y\right)}\right)}{x}} \]
      8. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{neg}\left(\left(t \cdot z - y\right)\right)}{x}}} \]
      9. distribute-frac-negN/A

        \[\leadsto \frac{1}{\color{blue}{\mathsf{neg}\left(\frac{t \cdot z - y}{x}\right)}} \]
      10. lift--.f64N/A

        \[\leadsto \frac{1}{\mathsf{neg}\left(\frac{\color{blue}{t \cdot z - y}}{x}\right)} \]
      11. div-subN/A

        \[\leadsto \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{t \cdot z}{x} - \frac{y}{x}\right)}\right)} \]
      12. sub-negN/A

        \[\leadsto \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{t \cdot z}{x} + \left(\mathsf{neg}\left(\frac{y}{x}\right)\right)\right)}\right)} \]
      13. distribute-neg-inN/A

        \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{neg}\left(\frac{t \cdot z}{x}\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{y}{x}\right)\right)\right)\right)}} \]
      14. distribute-neg-fracN/A

        \[\leadsto \frac{1}{\left(\mathsf{neg}\left(\frac{t \cdot z}{x}\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(y\right)}{x}}\right)\right)} \]
      15. distribute-frac-neg2N/A

        \[\leadsto \frac{1}{\left(\mathsf{neg}\left(\frac{t \cdot z}{x}\right)\right) + \color{blue}{\frac{\mathsf{neg}\left(y\right)}{\mathsf{neg}\left(x\right)}}} \]
      16. frac-2negN/A

        \[\leadsto \frac{1}{\left(\mathsf{neg}\left(\frac{t \cdot z}{x}\right)\right) + \color{blue}{\frac{y}{x}}} \]
      17. lift-*.f64N/A

        \[\leadsto \frac{1}{\left(\mathsf{neg}\left(\frac{\color{blue}{t \cdot z}}{x}\right)\right) + \frac{y}{x}} \]
      18. *-commutativeN/A

        \[\leadsto \frac{1}{\left(\mathsf{neg}\left(\frac{\color{blue}{z \cdot t}}{x}\right)\right) + \frac{y}{x}} \]
      19. associate-/l*N/A

        \[\leadsto \frac{1}{\left(\mathsf{neg}\left(\color{blue}{z \cdot \frac{t}{x}}\right)\right) + \frac{y}{x}} \]
      20. distribute-lft-neg-inN/A

        \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \frac{t}{x}} + \frac{y}{x}} \]
      21. lift-neg.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\left(-z\right)} \cdot \frac{t}{x} + \frac{y}{x}} \]
      22. lower-fma.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-z, \frac{t}{x}, \frac{y}{x}\right)}} \]
      23. lower-/.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-z, \color{blue}{\frac{t}{x}}, \frac{y}{x}\right)} \]
    6. Applied rewrites96.5%

      \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-z, \frac{t}{x}, \frac{y}{x}\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \cdot z \leq 10^{+268}:\\ \;\;\;\;\frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-z}{\frac{x\_m}{t}}}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= (* t z) 1e+268)
    (/ x_m (fma (- z) t y))
    (/ 1.0 (/ (- z) (/ x_m t))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((t * z) <= 1e+268) {
		tmp = x_m / fma(-z, t, y);
	} else {
		tmp = 1.0 / (-z / (x_m / t));
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (Float64(t * z) <= 1e+268)
		tmp = Float64(x_m / fma(Float64(-z), t, y));
	else
		tmp = Float64(1.0 / Float64(Float64(-z) / Float64(x_m / t)));
	end
	return Float64(x_s * tmp)
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(t * z), $MachinePrecision], 1e+268], N[(x$95$m / N[((-z) * t + y), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[((-z) / N[(x$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \cdot z \leq 10^{+268}:\\
\;\;\;\;\frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{-z}{\frac{x\_m}{t}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < 9.9999999999999997e267

    1. Initial program 99.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y - z \cdot t}} \]
      2. sub-negN/A

        \[\leadsto \frac{x}{\color{blue}{y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}} \]
      3. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + y}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x}{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + y} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + y} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), t, y\right)}} \]
      7. lower-neg.f6499.0

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{-z}, t, y\right)} \]
    4. Applied rewrites99.0%

      \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(-z, t, y\right)}} \]

    if 9.9999999999999997e267 < (*.f64 z t)

    1. Initial program 74.5%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{y - z \cdot t}} \]
      2. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}} \]
      4. lower-/.f6474.5

        \[\leadsto \frac{1}{\color{blue}{\frac{y - z \cdot t}{x}}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{y - \color{blue}{z \cdot t}}{x}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{y - \color{blue}{t \cdot z}}{x}} \]
      7. lower-*.f6474.5

        \[\leadsto \frac{1}{\frac{y - \color{blue}{t \cdot z}}{x}} \]
    4. Applied rewrites74.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{y - t \cdot z}{x}}} \]
    5. Taylor expanded in t around inf

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

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(-1 \cdot t\right) \cdot z}}{x}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(-1 \cdot t\right) \cdot z}}{x}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot z}{x}} \]
      4. lower-neg.f6474.5

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{t \cdot z}{x}}} \]
    9. Step-by-step derivation
      1. associate-*l/N/A

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

        \[\leadsto \frac{1}{\color{blue}{\left(-1 \cdot \frac{t}{x}\right) \cdot z}} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\left(-1 \cdot \frac{t}{x}\right) \cdot z}} \]
      4. associate-*r/N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{-1 \cdot t}{x}} \cdot z} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{-1 \cdot t}{x}} \cdot z} \]
      6. mul-1-negN/A

        \[\leadsto \frac{1}{\frac{\color{blue}{\mathsf{neg}\left(t\right)}}{x} \cdot z} \]
      7. lower-neg.f6499.7

        \[\leadsto \frac{1}{\frac{\color{blue}{-t}}{x} \cdot z} \]
    10. Applied rewrites99.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{-t}{x} \cdot z}} \]
    11. Step-by-step derivation
      1. Applied rewrites99.8%

        \[\leadsto \frac{1}{\frac{-z}{\color{blue}{\frac{x}{t}}}} \]
    12. Recombined 2 regimes into one program.
    13. Final simplification99.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq 10^{+268}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(-z, t, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-z}{\frac{x}{t}}}\\ \end{array} \]
    14. Add Preprocessing

    Alternative 3: 76.6% accurate, 0.5× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{x\_m}{\left(-t\right) \cdot z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+58}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+21}:\\ \;\;\;\;\frac{x\_m}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x_s x_m y z t)
     :precision binary64
     (let* ((t_1 (/ x_m (* (- t) z))))
       (* x_s (if (<= (* t z) -5e+58) t_1 (if (<= (* t z) 2e+21) (/ x_m y) t_1)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    assert(x_m < y && y < z && z < t);
    double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m / (-t * z);
    	double tmp;
    	if ((t * z) <= -5e+58) {
    		tmp = t_1;
    	} else if ((t * z) <= 2e+21) {
    		tmp = x_m / y;
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: tmp
        t_1 = x_m / (-t * z)
        if ((t * z) <= (-5d+58)) then
            tmp = t_1
        else if ((t * z) <= 2d+21) then
            tmp = x_m / y
        else
            tmp = t_1
        end if
        code = x_s * tmp
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    assert x_m < y && y < z && z < t;
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	double t_1 = x_m / (-t * z);
    	double tmp;
    	if ((t * z) <= -5e+58) {
    		tmp = t_1;
    	} else if ((t * z) <= 2e+21) {
    		tmp = x_m / y;
    	} else {
    		tmp = t_1;
    	}
    	return x_s * tmp;
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    [x_m, y, z, t] = sort([x_m, y, z, t])
    def code(x_s, x_m, y, z, t):
    	t_1 = x_m / (-t * z)
    	tmp = 0
    	if (t * z) <= -5e+58:
    		tmp = t_1
    	elif (t * z) <= 2e+21:
    		tmp = x_m / y
    	else:
    		tmp = t_1
    	return x_s * tmp
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    x_m, y, z, t = sort([x_m, y, z, t])
    function code(x_s, x_m, y, z, t)
    	t_1 = Float64(x_m / Float64(Float64(-t) * z))
    	tmp = 0.0
    	if (Float64(t * z) <= -5e+58)
    		tmp = t_1;
    	elseif (Float64(t * z) <= 2e+21)
    		tmp = Float64(x_m / y);
    	else
    		tmp = t_1;
    	end
    	return Float64(x_s * tmp)
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
    function tmp_2 = code(x_s, x_m, y, z, t)
    	t_1 = x_m / (-t * z);
    	tmp = 0.0;
    	if ((t * z) <= -5e+58)
    		tmp = t_1;
    	elseif ((t * z) <= 2e+21)
    		tmp = x_m / y;
    	else
    		tmp = t_1;
    	end
    	tmp_2 = x_s * tmp;
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m / N[((-t) * z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[N[(t * z), $MachinePrecision], -5e+58], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 2e+21], N[(x$95$m / y), $MachinePrecision], t$95$1]]), $MachinePrecision]]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    \\
    [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
    \\
    \begin{array}{l}
    t_1 := \frac{x\_m}{\left(-t\right) \cdot z}\\
    x\_s \cdot \begin{array}{l}
    \mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+58}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+21}:\\
    \;\;\;\;\frac{x\_m}{y}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 z t) < -4.99999999999999986e58 or 2e21 < (*.f64 z t)

      1. Initial program 93.7%

        \[\frac{x}{y - z \cdot t} \]
      2. Add Preprocessing
      3. Taylor expanded in t around inf

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

          \[\leadsto \frac{x}{\color{blue}{\left(-1 \cdot t\right) \cdot z}} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{x}{\color{blue}{\left(-1 \cdot t\right) \cdot z}} \]
        3. mul-1-negN/A

          \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot z} \]
        4. lower-neg.f6486.1

          \[\leadsto \frac{x}{\color{blue}{\left(-t\right)} \cdot z} \]
      5. Applied rewrites86.1%

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

      if -4.99999999999999986e58 < (*.f64 z t) < 2e21

      1. Initial program 99.9%

        \[\frac{x}{y - z \cdot t} \]
      2. Add Preprocessing
      3. Taylor expanded in t around 0

        \[\leadsto \color{blue}{\frac{x}{y}} \]
      4. Step-by-step derivation
        1. lower-/.f6480.0

          \[\leadsto \color{blue}{\frac{x}{y}} \]
      5. Applied rewrites80.0%

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

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

    Alternative 4: 98.1% accurate, 0.5× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \cdot z \leq 10^{+295}:\\ \;\;\;\;\frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-z}{x\_m} \cdot t}\\ \end{array} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x_s x_m y z t)
     :precision binary64
     (*
      x_s
      (if (<= (* t z) 1e+295)
        (/ x_m (fma (- z) t y))
        (/ 1.0 (* (/ (- z) x_m) t)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    assert(x_m < y && y < z && z < t);
    double code(double x_s, double x_m, double y, double z, double t) {
    	double tmp;
    	if ((t * z) <= 1e+295) {
    		tmp = x_m / fma(-z, t, y);
    	} else {
    		tmp = 1.0 / ((-z / x_m) * t);
    	}
    	return x_s * tmp;
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    x_m, y, z, t = sort([x_m, y, z, t])
    function code(x_s, x_m, y, z, t)
    	tmp = 0.0
    	if (Float64(t * z) <= 1e+295)
    		tmp = Float64(x_m / fma(Float64(-z), t, y));
    	else
    		tmp = Float64(1.0 / Float64(Float64(Float64(-z) / x_m) * t));
    	end
    	return Float64(x_s * tmp)
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(t * z), $MachinePrecision], 1e+295], N[(x$95$m / N[((-z) * t + y), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[((-z) / x$95$m), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    \\
    [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
    \\
    x\_s \cdot \begin{array}{l}
    \mathbf{if}\;t \cdot z \leq 10^{+295}:\\
    \;\;\;\;\frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{-z}{x\_m} \cdot t}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 z t) < 9.9999999999999998e294

      1. Initial program 99.0%

        \[\frac{x}{y - z \cdot t} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift--.f64N/A

          \[\leadsto \frac{x}{\color{blue}{y - z \cdot t}} \]
        2. sub-negN/A

          \[\leadsto \frac{x}{\color{blue}{y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}} \]
        3. +-commutativeN/A

          \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + y}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{x}{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + y} \]
        5. distribute-lft-neg-inN/A

          \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + y} \]
        6. lower-fma.f64N/A

          \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), t, y\right)}} \]
        7. lower-neg.f6499.1

          \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{-z}, t, y\right)} \]
      4. Applied rewrites99.1%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(-z, t, y\right)}} \]

      if 9.9999999999999998e294 < (*.f64 z t)

      1. Initial program 67.2%

        \[\frac{x}{y - z \cdot t} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x}{y - z \cdot t}} \]
        2. clear-numN/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}} \]
        3. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}} \]
        4. lower-/.f6467.2

          \[\leadsto \frac{1}{\color{blue}{\frac{y - z \cdot t}{x}}} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{1}{\frac{y - \color{blue}{z \cdot t}}{x}} \]
        6. *-commutativeN/A

          \[\leadsto \frac{1}{\frac{y - \color{blue}{t \cdot z}}{x}} \]
        7. lower-*.f6467.2

          \[\leadsto \frac{1}{\frac{y - \color{blue}{t \cdot z}}{x}} \]
      4. Applied rewrites67.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{y - t \cdot z}{x}}} \]
      5. Taylor expanded in t around inf

        \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{t \cdot z}{x}}} \]
      6. Step-by-step derivation
        1. associate-/l*N/A

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

          \[\leadsto \frac{1}{\color{blue}{\left(-1 \cdot t\right) \cdot \frac{z}{x}}} \]
        3. lower-*.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\left(-1 \cdot t\right) \cdot \frac{z}{x}}} \]
        4. mul-1-negN/A

          \[\leadsto \frac{1}{\color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot \frac{z}{x}} \]
        5. lower-neg.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\left(-t\right)} \cdot \frac{z}{x}} \]
        6. lower-/.f6499.7

          \[\leadsto \frac{1}{\left(-t\right) \cdot \color{blue}{\frac{z}{x}}} \]
      7. Applied rewrites99.7%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot z \leq 10^{+295}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(-z, t, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-z}{x} \cdot t}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 95.9% accurate, 1.0× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x_s x_m y z t) :precision binary64 (* x_s (/ x_m (fma (- z) t y))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    assert(x_m < y && y < z && z < t);
    double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m / fma(-z, t, y));
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    x_m, y, z, t = sort([x_m, y, z, t])
    function code(x_s, x_m, y, z, t)
    	return Float64(x_s * Float64(x_m / fma(Float64(-z), t, y)))
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m / N[((-z) * t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    \\
    [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
    \\
    x\_s \cdot \frac{x\_m}{\mathsf{fma}\left(-z, t, y\right)}
    \end{array}
    
    Derivation
    1. Initial program 96.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y - z \cdot t}} \]
      2. sub-negN/A

        \[\leadsto \frac{x}{\color{blue}{y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}} \]
      3. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + y}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x}{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + y} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + y} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), t, y\right)}} \]
      7. lower-neg.f6496.9

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{-z}, t, y\right)} \]
    4. Applied rewrites96.9%

      \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(-z, t, y\right)}} \]
    5. Add Preprocessing

    Alternative 6: 95.9% accurate, 1.0× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \frac{x\_m}{y - t \cdot z} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x_s x_m y z t) :precision binary64 (* x_s (/ x_m (- y (* t z)))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    assert(x_m < y && y < z && z < t);
    double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m / (y - (t * z)));
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        code = x_s * (x_m / (y - (t * z)))
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    assert x_m < y && y < z && z < t;
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m / (y - (t * z)));
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    [x_m, y, z, t] = sort([x_m, y, z, t])
    def code(x_s, x_m, y, z, t):
    	return x_s * (x_m / (y - (t * z)))
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    x_m, y, z, t = sort([x_m, y, z, t])
    function code(x_s, x_m, y, z, t)
    	return Float64(x_s * Float64(x_m / Float64(y - Float64(t * z))))
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
    function tmp = code(x_s, x_m, y, z, t)
    	tmp = x_s * (x_m / (y - (t * z)));
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m / N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    \\
    [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
    \\
    x\_s \cdot \frac{x\_m}{y - t \cdot z}
    \end{array}
    
    Derivation
    1. Initial program 96.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Final simplification96.9%

      \[\leadsto \frac{x}{y - t \cdot z} \]
    4. Add Preprocessing

    Alternative 7: 64.4% accurate, 1.1× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \frac{x\_m}{\mathsf{fma}\left(z, t, y\right)} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x_s x_m y z t) :precision binary64 (* x_s (/ x_m (fma z t y))))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    assert(x_m < y && y < z && z < t);
    double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m / fma(z, t, y));
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    x_m, y, z, t = sort([x_m, y, z, t])
    function code(x_s, x_m, y, z, t)
    	return Float64(x_s * Float64(x_m / fma(z, t, y)))
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m / N[(z * t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    \\
    [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
    \\
    x\_s \cdot \frac{x\_m}{\mathsf{fma}\left(z, t, y\right)}
    \end{array}
    
    Derivation
    1. Initial program 96.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y - z \cdot t}} \]
      2. sub-negN/A

        \[\leadsto \frac{x}{\color{blue}{y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}} \]
      3. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + y}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x}{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + y} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{x}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + y} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), t, y\right)}} \]
      7. lower-neg.f6496.9

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{-z}, t, y\right)} \]
    4. Applied rewrites96.9%

      \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(-z, t, y\right)}} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(z\right)}, t, y\right)} \]
      2. neg-sub0N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{0 - z}, t, y\right)} \]
      3. mul0-lftN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{0 \cdot \frac{t \cdot z - y}{x}} - z, t, y\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{0 \cdot \frac{t \cdot z - y}{x}} - z, t, y\right)} \]
      5. flip--N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\frac{\left(0 \cdot \frac{t \cdot z - y}{x}\right) \cdot \left(0 \cdot \frac{t \cdot z - y}{x}\right) - z \cdot z}{0 \cdot \frac{t \cdot z - y}{x} + z}}, t, y\right)} \]
      6. div-invN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(\left(0 \cdot \frac{t \cdot z - y}{x}\right) \cdot \left(0 \cdot \frac{t \cdot z - y}{x}\right) - z \cdot z\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}}, t, y\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(\left(0 \cdot \frac{t \cdot z - y}{x}\right) \cdot \left(0 \cdot \frac{t \cdot z - y}{x}\right) - z \cdot z\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}}, t, y\right)} \]
      8. lift-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(\color{blue}{\left(0 \cdot \frac{t \cdot z - y}{x}\right)} \cdot \left(0 \cdot \frac{t \cdot z - y}{x}\right) - z \cdot z\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      9. mul0-lftN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(\color{blue}{0} \cdot \left(0 \cdot \frac{t \cdot z - y}{x}\right) - z \cdot z\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(0 \cdot \color{blue}{\left(0 \cdot \frac{t \cdot z - y}{x}\right)} - z \cdot z\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      11. mul0-lftN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(0 \cdot \color{blue}{0} - z \cdot z\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      12. metadata-evalN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(\color{blue}{0} - z \cdot z\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      13. sub0-negN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(z \cdot z\right)\right)} \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      14. lower-neg.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(-z \cdot z\right)} \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      15. lower-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(-\color{blue}{z \cdot z}\right) \cdot \frac{1}{0 \cdot \frac{t \cdot z - y}{x} + z}, t, y\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(-z \cdot z\right) \cdot \frac{1}{\color{blue}{0 \cdot \frac{t \cdot z - y}{x}} + z}, t, y\right)} \]
      17. mul0-lftN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(-z \cdot z\right) \cdot \frac{1}{\color{blue}{0} + z}, t, y\right)} \]
      18. +-lft-identityN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(-z \cdot z\right) \cdot \frac{1}{\color{blue}{z}}, t, y\right)} \]
      19. lower-/.f6481.3

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(-z \cdot z\right) \cdot \color{blue}{\frac{1}{z}}, t, y\right)} \]
    6. Applied rewrites81.3%

      \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(-z \cdot z\right) \cdot \frac{1}{z}}, t, y\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(-z \cdot z\right) \cdot \frac{1}{z}}, t, y\right)} \]
      2. *-commutativeN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\frac{1}{z} \cdot \left(-z \cdot z\right)}, t, y\right)} \]
      3. lift-neg.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\frac{1}{z} \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot z\right)\right)}, t, y\right)} \]
      4. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(\frac{1}{z} \cdot \left(z \cdot z\right)\right)}, t, y\right)} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{z}\right)\right) \cdot \left(z \cdot z\right)}, t, y\right)} \]
      6. neg-mul-1N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\left(-1 \cdot \frac{1}{z}\right)} \cdot \left(z \cdot z\right), t, y\right)} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\left(-1 \cdot \color{blue}{\frac{1}{z}}\right) \cdot \left(z \cdot z\right), t, y\right)} \]
      8. div-invN/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\frac{-1}{z}} \cdot \left(z \cdot z\right), t, y\right)} \]
      9. lower-*.f64N/A

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\frac{-1}{z} \cdot \left(z \cdot z\right)}, t, y\right)} \]
      10. lower-/.f6481.3

        \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\frac{-1}{z}} \cdot \left(z \cdot z\right), t, y\right)} \]
    8. Applied rewrites81.3%

      \[\leadsto \frac{x}{\mathsf{fma}\left(\color{blue}{\frac{-1}{z} \cdot \left(z \cdot z\right)}, t, y\right)} \]
    9. Applied rewrites64.3%

      \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(z, t, y\right)}} \]
    10. Add Preprocessing

    Alternative 8: 54.1% accurate, 1.7× speedup?

    \[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \frac{x\_m}{y} \end{array} \]
    x\_m = (fabs.f64 x)
    x\_s = (copysign.f64 #s(literal 1 binary64) x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x_s x_m y z t) :precision binary64 (* x_s (/ x_m y)))
    x\_m = fabs(x);
    x\_s = copysign(1.0, x);
    assert(x_m < y && y < z && z < t);
    double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m / y);
    }
    
    x\_m = abs(x)
    x\_s = copysign(1.0d0, x)
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    real(8) function code(x_s, x_m, y, z, t)
        real(8), intent (in) :: x_s
        real(8), intent (in) :: x_m
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        code = x_s * (x_m / y)
    end function
    
    x\_m = Math.abs(x);
    x\_s = Math.copySign(1.0, x);
    assert x_m < y && y < z && z < t;
    public static double code(double x_s, double x_m, double y, double z, double t) {
    	return x_s * (x_m / y);
    }
    
    x\_m = math.fabs(x)
    x\_s = math.copysign(1.0, x)
    [x_m, y, z, t] = sort([x_m, y, z, t])
    def code(x_s, x_m, y, z, t):
    	return x_s * (x_m / y)
    
    x\_m = abs(x)
    x\_s = copysign(1.0, x)
    x_m, y, z, t = sort([x_m, y, z, t])
    function code(x_s, x_m, y, z, t)
    	return Float64(x_s * Float64(x_m / y))
    end
    
    x\_m = abs(x);
    x\_s = sign(x) * abs(1.0);
    x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
    function tmp = code(x_s, x_m, y, z, t)
    	tmp = x_s * (x_m / y);
    end
    
    x\_m = N[Abs[x], $MachinePrecision]
    x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
    code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    x\_m = \left|x\right|
    \\
    x\_s = \mathsf{copysign}\left(1, x\right)
    \\
    [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
    \\
    x\_s \cdot \frac{x\_m}{y}
    \end{array}
    
    Derivation
    1. Initial program 96.9%

      \[\frac{x}{y - z \cdot t} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    4. Step-by-step derivation
      1. lower-/.f6452.3

        \[\leadsto \color{blue}{\frac{x}{y}} \]
    5. Applied rewrites52.3%

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

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

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

    Reproduce

    ?
    herbie shell --seed 2024268 
    (FPCore (x y z t)
      :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
      :precision binary64
    
      :alt
      (! :herbie-platform default (if (< x -161819597360704900000000000000000000000000000000000) (/ 1 (- (/ y x) (* (/ z x) t))) (if (< x 213783064348764440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ x (- y (* z t))) (/ 1 (- (/ y x) (* (/ z x) t))))))
    
      (/ x (- y (* z t))))