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

Percentage Accurate: 96.0% → 99.8%
Time: 8.0s
Alternatives: 7
Speedup: 0.3×

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: 96.0% 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.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\frac{\frac{x}{-t}}{z}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+260}:\\ \;\;\;\;\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) (- INFINITY))
   (/ (/ x (- t)) z)
   (if (<= (* z t) 5e+260) (/ x (- y (* z t))) (* (/ -1.0 z) (/ x t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -((double) INFINITY)) {
		tmp = (x / -t) / z;
	} else if ((z * t) <= 5e+260) {
		tmp = x / (y - (z * t));
	} else {
		tmp = (-1.0 / z) * (x / t);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * t) <= -Double.POSITIVE_INFINITY) {
		tmp = (x / -t) / z;
	} else if ((z * t) <= 5e+260) {
		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) <= -math.inf:
		tmp = (x / -t) / z
	elif (z * t) <= 5e+260:
		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) <= Float64(-Inf))
		tmp = Float64(Float64(x / Float64(-t)) / z);
	elseif (Float64(z * t) <= 5e+260)
		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) <= -Inf)
		tmp = (x / -t) / z;
	elseif ((z * t) <= 5e+260)
		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], (-Infinity)], N[(N[(x / (-t)), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+260], 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 -\infty:\\
\;\;\;\;\frac{\frac{x}{-t}}{z}\\

\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+260}:\\
\;\;\;\;\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) < -inf.0

    1. Initial program 58.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    7. Applied egg-rr100.0%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{--1}{-t}} \cdot x}{z} \]
      5. metadata-eval99.7%

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{-t}}}{z} \]
      7. *-un-lft-identity100.0%

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

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

    if -inf.0 < (*.f64 z t) < 4.9999999999999996e260

    1. Initial program 99.9%

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

    if 4.9999999999999996e260 < (*.f64 z t)

    1. Initial program 77.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    5. Simplified77.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    7. Applied egg-rr100.0%

      \[\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 -\infty:\\ \;\;\;\;\frac{\frac{x}{-t}}{z}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+260}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 71.5% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{y}\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.40000000000000006e37 or 1.35000000000000008e-67 < y

    1. Initial program 99.3%

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

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

    if -3.40000000000000006e37 < y < 1.39999999999999988e-274

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{--1}{-t}} \cdot x}{z} \]
      5. metadata-eval75.7%

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{-t}}}{z} \]
      7. *-un-lft-identity75.9%

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

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

    if 1.39999999999999988e-274 < y < 1.35000000000000003e-128

    1. Initial program 96.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{z}}{t}} \]
    5. Simplified83.0%

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

    if 1.35000000000000003e-128 < y < 1.35000000000000008e-67

    1. Initial program 100.0%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    5. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+37}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-274}:\\ \;\;\;\;\frac{\frac{x}{-t}}{z}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{-128}:\\ \;\;\;\;\frac{\frac{-x}{z}}{t}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{-67}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.7% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-20} \lor \neg \left(y \leq 4.1 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.39999999999999993e-20 or 4.09999999999999983e26 < y

    1. Initial program 96.5%

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

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

    if -2.39999999999999993e-20 < y < 4.09999999999999983e26

    1. Initial program 94.9%

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

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

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

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

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

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

Alternative 4: 71.6% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+37} \lor \neg \left(y \leq 10^{-67}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.1000000000000002e37 or 9.99999999999999943e-68 < y

    1. Initial program 99.3%

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

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

    if -3.1000000000000002e37 < y < 9.99999999999999943e-68

    1. Initial program 90.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{--1}{-t}} \cdot x}{z} \]
      5. metadata-eval78.1%

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{-t}}}{z} \]
      7. *-un-lft-identity78.2%

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

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

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

Alternative 5: 53.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-48} \lor \neg \left(t \leq 1.35 \cdot 10^{+217}\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 < -2.9000000000000003e-48 or 1.35000000000000001e217 < t

    1. Initial program 92.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{z}}{t}} \]
      2. expm1-log1p-u66.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{z}}{t}\right)\right)} \]
      3. expm1-udef42.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    9. Simplified36.0%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    10. Taylor expanded in x around 0 36.2%

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

    if -2.9000000000000003e-48 < t < 1.35000000000000001e217

    1. Initial program 97.6%

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

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

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

Alternative 6: 53.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-48}:\\
\;\;\;\;\frac{x}{z \cdot t}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.9000000000000003e-48

    1. Initial program 94.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{-x}{z}}{t}} \]
      2. expm1-log1p-u63.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{z}}{t}\right)\right)} \]
      3. expm1-udef40.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    9. Simplified32.3%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{t}} \]
    10. Taylor expanded in x around 0 32.4%

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

    if -2.9000000000000003e-48 < t < 2.7000000000000001e216

    1. Initial program 97.6%

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

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

    if 2.7000000000000001e216 < t

    1. Initial program 87.5%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{t \cdot z} \]
    5. Simplified74.0%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot \frac{x}{t}} \]
    7. Applied egg-rr86.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{--1}{-t}} \cdot x}{z} \]
      5. metadata-eval86.2%

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

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{-t}}}{z} \]
      7. *-un-lft-identity86.4%

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

      \[\leadsto \color{blue}{\frac{\frac{x}{-t}}{z}} \]
    10. Step-by-step derivation
      1. associate-/l/74.0%

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\sqrt{t} \cdot \sqrt{t}}} \]
      7. add-sqr-sqrt50.4%

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

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

        \[\leadsto \frac{x}{\color{blue}{t \cdot z}} \]
      10. expm1-log1p-u50.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{t}}{z}} \]
    13. Simplified50.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.9 \cdot 10^{-48}:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{elif}\;t \leq 2.7 \cdot 10^{+216}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 54.8% 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 95.7%

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

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  4. Final simplification51.3%

    \[\leadsto \frac{x}{y} \]
  5. Add Preprocessing

Developer target: 96.9% accurate, 0.3× 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 2024031 
(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))))