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

Percentage Accurate: 95.5% → 99.7%
Time: 8.3s
Alternatives: 7
Speedup: 0.5×

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 7 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.5% 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: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+246}:\\ \;\;\;\;\frac{\frac{x}{z}}{-t}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+251}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z t) -2e+246)
   (/ (/ x z) (- t))
   (if (<= (* z t) 2e+251) (/ x (fma z (- t) y)) (* (/ -1.0 z) (/ x t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -2e+246) {
		tmp = (x / z) / -t;
	} else if ((z * t) <= 2e+251) {
		tmp = x / fma(z, -t, y);
	} else {
		tmp = (-1.0 / z) * (x / t);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * t) <= -2e+246)
		tmp = Float64(Float64(x / z) / Float64(-t));
	elseif (Float64(z * t) <= 2e+251)
		tmp = Float64(x / fma(z, Float64(-t), y));
	else
		tmp = Float64(Float64(-1.0 / z) * Float64(x / t));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+246], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+251], N[(x / N[(z * (-t) + y), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+246}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+251}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -2.00000000000000014e246

    1. Initial program 75.4%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 75.4%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-175.4%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative75.4%

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

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. neg-mul-175.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative75.4%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      3. times-frac99.9%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    7. Step-by-step derivation
      1. frac-2neg99.9%

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

        \[\leadsto \color{blue}{\frac{\frac{-1}{z} \cdot \left(-x\right)}{-t}} \]
      3. add-sqr-sqrt60.5%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)}}{-t} \]
      4. sqrt-unprod74.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{-t} \]
      5. sqr-neg74.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \sqrt{\color{blue}{x \cdot x}}}{-t} \]
      6. sqrt-unprod26.4%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}{-t} \]
      7. add-sqr-sqrt58.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{x}}{-t} \]
      8. associate-*l/58.2%

        \[\leadsto \frac{\color{blue}{\frac{-1 \cdot x}{z}}}{-t} \]
      9. neg-mul-158.2%

        \[\leadsto \frac{\frac{\color{blue}{-x}}{z}}{-t} \]
      10. add-sqr-sqrt31.8%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{z}}{-t} \]
      11. sqrt-unprod53.8%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{z}}{-t} \]
      12. sqr-neg53.8%

        \[\leadsto \frac{\frac{\sqrt{\color{blue}{x \cdot x}}}{z}}{-t} \]
      13. sqrt-unprod39.1%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{z}}{-t} \]
      14. add-sqr-sqrt99.9%

        \[\leadsto \frac{\frac{\color{blue}{x}}{z}}{-t} \]
    8. Applied egg-rr99.9%

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

    if -2.00000000000000014e246 < (*.f64 z t) < 2.0000000000000001e251

    1. Initial program 99.8%

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

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

        \[\leadsto \frac{x}{y + \color{blue}{z \cdot \left(-t\right)}} \]
      3. +-commutative99.8%

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

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

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

    if 2.0000000000000001e251 < (*.f64 z t)

    1. Initial program 68.4%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 68.4%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-168.4%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative68.4%

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

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. neg-mul-168.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative68.4%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      3. times-frac99.8%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+246}:\\ \;\;\;\;\frac{\frac{x}{z}}{-t}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+251}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \end{array} \]

Alternative 2: 99.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+246}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -2.00000000000000014e246

    1. Initial program 75.4%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 75.4%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-175.4%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative75.4%

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

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. neg-mul-175.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative75.4%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      3. times-frac99.9%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    7. Step-by-step derivation
      1. frac-2neg99.9%

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

        \[\leadsto \color{blue}{\frac{\frac{-1}{z} \cdot \left(-x\right)}{-t}} \]
      3. add-sqr-sqrt60.5%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)}}{-t} \]
      4. sqrt-unprod74.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{-t} \]
      5. sqr-neg74.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \sqrt{\color{blue}{x \cdot x}}}{-t} \]
      6. sqrt-unprod26.4%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}{-t} \]
      7. add-sqr-sqrt58.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{x}}{-t} \]
      8. associate-*l/58.2%

        \[\leadsto \frac{\color{blue}{\frac{-1 \cdot x}{z}}}{-t} \]
      9. neg-mul-158.2%

        \[\leadsto \frac{\frac{\color{blue}{-x}}{z}}{-t} \]
      10. add-sqr-sqrt31.8%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{z}}{-t} \]
      11. sqrt-unprod53.8%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{z}}{-t} \]
      12. sqr-neg53.8%

        \[\leadsto \frac{\frac{\sqrt{\color{blue}{x \cdot x}}}{z}}{-t} \]
      13. sqrt-unprod39.1%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{z}}{-t} \]
      14. add-sqr-sqrt99.9%

        \[\leadsto \frac{\frac{\color{blue}{x}}{z}}{-t} \]
    8. Applied egg-rr99.9%

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

    if -2.00000000000000014e246 < (*.f64 z t) < 2.0000000000000001e251

    1. Initial program 99.8%

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

    if 2.0000000000000001e251 < (*.f64 z t)

    1. Initial program 68.4%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 68.4%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-168.4%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative68.4%

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

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. neg-mul-168.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative68.4%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      3. times-frac99.8%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr99.8%

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

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

Alternative 3: 67.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{-19} \lor \neg \left(t \leq 1.8 \cdot 10^{-6} \lor \neg \left(t \leq 1750000\right) \land t \leq 3.1 \cdot 10^{+97}\right):\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -9e-19)
         (not (or (<= t 1.8e-6) (and (not (<= t 1750000.0)) (<= t 3.1e+97)))))
   (/ (- x) (* z t))
   (/ x y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -9e-19) || !((t <= 1.8e-6) || (!(t <= 1750000.0) && (t <= 3.1e+97)))) {
		tmp = -x / (z * t);
	} else {
		tmp = x / y;
	}
	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) :: tmp
    if ((t <= (-9d-19)) .or. (.not. (t <= 1.8d-6) .or. (.not. (t <= 1750000.0d0)) .and. (t <= 3.1d+97))) then
        tmp = -x / (z * t)
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -9e-19) || !((t <= 1.8e-6) || (!(t <= 1750000.0) && (t <= 3.1e+97)))) {
		tmp = -x / (z * t);
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -9e-19) or not ((t <= 1.8e-6) or (not (t <= 1750000.0) and (t <= 3.1e+97))):
		tmp = -x / (z * t)
	else:
		tmp = x / y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -9e-19) || !((t <= 1.8e-6) || (!(t <= 1750000.0) && (t <= 3.1e+97))))
		tmp = Float64(Float64(-x) / Float64(z * t));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -9e-19) || ~(((t <= 1.8e-6) || (~((t <= 1750000.0)) && (t <= 3.1e+97)))))
		tmp = -x / (z * t);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9e-19], N[Not[Or[LessEqual[t, 1.8e-6], And[N[Not[LessEqual[t, 1750000.0]], $MachinePrecision], LessEqual[t, 3.1e+97]]]], $MachinePrecision]], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-19} \lor \neg \left(t \leq 1.8 \cdot 10^{-6} \lor \neg \left(t \leq 1750000\right) \land t \leq 3.1 \cdot 10^{+97}\right):\\
\;\;\;\;\frac{-x}{z \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -9.00000000000000026e-19 or 1.79999999999999992e-6 < t < 1.75e6 or 3.09999999999999981e97 < t

    1. Initial program 88.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 72.6%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-172.6%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative72.6%

        \[\leadsto \frac{-x}{\color{blue}{t \cdot z}} \]
    4. Simplified72.6%

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

    if -9.00000000000000026e-19 < t < 1.79999999999999992e-6 or 1.75e6 < t < 3.09999999999999981e97

    1. Initial program 98.0%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 74.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{-19} \lor \neg \left(t \leq 1.8 \cdot 10^{-6} \lor \neg \left(t \leq 1750000\right) \land t \leq 3.1 \cdot 10^{+97}\right):\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 4: 70.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.4 \cdot 10^{-18} \lor \neg \left(t \leq 6.4 \cdot 10^{-6} \lor \neg \left(t \leq 21500000\right) \land t \leq 8.5 \cdot 10^{+83}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{-t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -1.4e-18)
         (not (or (<= t 6.4e-6) (and (not (<= t 21500000.0)) (<= t 8.5e+83)))))
   (/ (/ x z) (- t))
   (/ x y)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -1.4e-18) || !((t <= 6.4e-6) || (!(t <= 21500000.0) && (t <= 8.5e+83)))) {
		tmp = (x / z) / -t;
	} else {
		tmp = x / y;
	}
	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) :: tmp
    if ((t <= (-1.4d-18)) .or. (.not. (t <= 6.4d-6) .or. (.not. (t <= 21500000.0d0)) .and. (t <= 8.5d+83))) then
        tmp = (x / z) / -t
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -1.4e-18) || !((t <= 6.4e-6) || (!(t <= 21500000.0) && (t <= 8.5e+83)))) {
		tmp = (x / z) / -t;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -1.4e-18) or not ((t <= 6.4e-6) or (not (t <= 21500000.0) and (t <= 8.5e+83))):
		tmp = (x / z) / -t
	else:
		tmp = x / y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -1.4e-18) || !((t <= 6.4e-6) || (!(t <= 21500000.0) && (t <= 8.5e+83))))
		tmp = Float64(Float64(x / z) / Float64(-t));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -1.4e-18) || ~(((t <= 6.4e-6) || (~((t <= 21500000.0)) && (t <= 8.5e+83)))))
		tmp = (x / z) / -t;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.4e-18], N[Not[Or[LessEqual[t, 6.4e-6], And[N[Not[LessEqual[t, 21500000.0]], $MachinePrecision], LessEqual[t, 8.5e+83]]]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-18} \lor \neg \left(t \leq 6.4 \cdot 10^{-6} \lor \neg \left(t \leq 21500000\right) \land t \leq 8.5 \cdot 10^{+83}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.40000000000000006e-18 or 6.3999999999999997e-6 < t < 2.15e7 or 8.4999999999999995e83 < t

    1. Initial program 86.5%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 71.6%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-171.6%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative71.6%

        \[\leadsto \frac{-x}{\color{blue}{t \cdot z}} \]
    4. Simplified71.6%

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. neg-mul-171.6%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative71.6%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      3. times-frac84.8%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr84.8%

      \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    7. Step-by-step derivation
      1. frac-2neg84.8%

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

        \[\leadsto \color{blue}{\frac{\frac{-1}{z} \cdot \left(-x\right)}{-t}} \]
      3. add-sqr-sqrt42.8%

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

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

        \[\leadsto \frac{\frac{-1}{z} \cdot \sqrt{\color{blue}{x \cdot x}}}{-t} \]
      6. sqrt-unprod14.9%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}{-t} \]
      7. add-sqr-sqrt33.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{x}}{-t} \]
      8. associate-*l/33.2%

        \[\leadsto \frac{\color{blue}{\frac{-1 \cdot x}{z}}}{-t} \]
      9. neg-mul-133.2%

        \[\leadsto \frac{\frac{\color{blue}{-x}}{z}}{-t} \]
      10. add-sqr-sqrt18.3%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{z}}{-t} \]
      11. sqrt-unprod46.4%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{z}}{-t} \]
      12. sqr-neg46.4%

        \[\leadsto \frac{\frac{\sqrt{\color{blue}{x \cdot x}}}{z}}{-t} \]
      13. sqrt-unprod37.9%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{z}}{-t} \]
      14. add-sqr-sqrt81.0%

        \[\leadsto \frac{\frac{\color{blue}{x}}{z}}{-t} \]
    8. Applied egg-rr81.0%

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

    if -1.40000000000000006e-18 < t < 6.3999999999999997e-6 or 2.15e7 < t < 8.4999999999999995e83

    1. Initial program 99.2%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 75.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.4 \cdot 10^{-18} \lor \neg \left(t \leq 6.4 \cdot 10^{-6} \lor \neg \left(t \leq 21500000\right) \land t \leq 8.5 \cdot 10^{+83}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{-t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 5: 71.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{-\frac{x}{t}}{z}\\
\mathbf{if}\;t \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;t \leq 1.95 \cdot 10^{+84}:\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.4999999999999999e-20 or 1.95000000000000008e84 < t

    1. Initial program 85.7%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 70.8%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-170.8%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative70.8%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{\frac{x}{t}}{z}} \]
      2. mul-1-neg84.9%

        \[\leadsto \color{blue}{-\frac{\frac{x}{t}}{z}} \]
      3. distribute-neg-frac84.9%

        \[\leadsto \color{blue}{\frac{-\frac{x}{t}}{z}} \]
      4. distribute-neg-frac84.9%

        \[\leadsto \frac{\color{blue}{\frac{-x}{t}}}{z} \]
    7. Simplified84.9%

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

    if -2.4999999999999999e-20 < t < 2.1500000000000001e-7 or 1.2e7 < t < 1.95000000000000008e84

    1. Initial program 99.2%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 75.6%

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

    if 2.1500000000000001e-7 < t < 1.2e7

    1. Initial program 99.7%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 84.2%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-184.2%

        \[\leadsto \frac{\color{blue}{-x}}{z \cdot t} \]
      4. *-commutative84.2%

        \[\leadsto \frac{-x}{\color{blue}{t \cdot z}} \]
    4. Simplified84.2%

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. neg-mul-184.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot x}}{t \cdot z} \]
      2. *-commutative84.2%

        \[\leadsto \frac{-1 \cdot x}{\color{blue}{z \cdot t}} \]
      3. times-frac83.9%

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    6. Applied egg-rr83.9%

      \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    7. Step-by-step derivation
      1. frac-2neg83.9%

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

        \[\leadsto \color{blue}{\frac{\frac{-1}{z} \cdot \left(-x\right)}{-t}} \]
      3. add-sqr-sqrt67.5%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)}}{-t} \]
      4. sqrt-unprod51.6%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{-t} \]
      5. sqr-neg51.6%

        \[\leadsto \frac{\frac{-1}{z} \cdot \sqrt{\color{blue}{x \cdot x}}}{-t} \]
      6. sqrt-unprod0.2%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}{-t} \]
      7. add-sqr-sqrt2.5%

        \[\leadsto \frac{\frac{-1}{z} \cdot \color{blue}{x}}{-t} \]
      8. associate-*l/2.5%

        \[\leadsto \frac{\color{blue}{\frac{-1 \cdot x}{z}}}{-t} \]
      9. neg-mul-12.5%

        \[\leadsto \frac{\frac{\color{blue}{-x}}{z}}{-t} \]
      10. add-sqr-sqrt2.3%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{z}}{-t} \]
      11. sqrt-unprod19.2%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{z}}{-t} \]
      12. sqr-neg19.2%

        \[\leadsto \frac{\frac{\sqrt{\color{blue}{x \cdot x}}}{z}}{-t} \]
      13. sqrt-unprod16.7%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{z}}{-t} \]
      14. add-sqr-sqrt84.2%

        \[\leadsto \frac{\frac{\color{blue}{x}}{z}}{-t} \]
    8. Applied egg-rr84.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.5 \cdot 10^{-20}:\\ \;\;\;\;\frac{-\frac{x}{t}}{z}\\ \mathbf{elif}\;t \leq 2.15 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t \leq 12000000:\\ \;\;\;\;\frac{\frac{x}{z}}{-t}\\ \mathbf{elif}\;t \leq 1.95 \cdot 10^{+84}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\frac{x}{t}}{z}\\ \end{array} \]

Alternative 6: 53.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-18} \lor \neg \left(t \leq 1.5 \cdot 10^{+110}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.40000000000000006e-18 or 1.50000000000000004e110 < t

    1. Initial program 87.7%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around 0 72.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot t}} \]
      3. neg-mul-172.7%

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

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

      \[\leadsto \color{blue}{\frac{-x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u66.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-x}{t \cdot z}\right)\right)} \]
      2. expm1-udef43.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-x}{t \cdot z}\right)} - 1} \]
      3. add-sqr-sqrt24.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{t \cdot z}\right)} - 1 \]
      4. sqrt-unprod39.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{t \cdot z}\right)} - 1 \]
      5. sqr-neg39.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{t \cdot z}\right)} - 1 \]
      6. sqrt-unprod17.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{t \cdot z}\right)} - 1 \]
      7. add-sqr-sqrt39.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{t \cdot z}\right)} - 1 \]
      8. associate-/r*39.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{x}{t}}{z}}\right)} - 1 \]
    6. Applied egg-rr39.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{x}{t}}{z}\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def37.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{x}{t}}{z}\right)\right)} \]
      2. expm1-log1p37.6%

        \[\leadsto \color{blue}{\frac{\frac{x}{t}}{z}} \]
      3. associate-/r*36.7%

        \[\leadsto \color{blue}{\frac{x}{t \cdot z}} \]
    8. Simplified36.7%

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

    if -1.40000000000000006e-18 < t < 1.50000000000000004e110

    1. Initial program 97.5%

      \[\frac{x}{y - z \cdot t} \]
    2. Taylor expanded in y around inf 71.6%

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

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

Alternative 7: 53.4% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \frac{x}{y} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x y))
double code(double x, double y, double z, double t) {
	return x / y;
}
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
end function
public static double code(double x, double y, double z, double t) {
	return x / y;
}
def code(x, y, z, t):
	return x / y
function code(x, y, z, t)
	return Float64(x / y)
end
function tmp = code(x, y, z, t)
	tmp = x / y;
end
code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 94.0%

    \[\frac{x}{y - z \cdot t} \]
  2. Taylor expanded in y around inf 55.9%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Final simplification55.9%

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

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

  :herbie-target
  (if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))

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