Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A

Percentage Accurate: 99.0% → 99.5%
Time: 12.1s
Alternatives: 14
Speedup: 0.7×

Specification

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

\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\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 14 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: 99.0% accurate, 1.0× speedup?

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

\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}

Alternative 1: 99.5% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -2 \cdot 10^{+36}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{y - t}}{z - y}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= z -2e+36)
   (+ 1.0 (/ (/ x z) (- y t)))
   (+ 1.0 (/ (/ x (- y t)) (- z y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -2e+36) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else {
		tmp = 1.0 + ((x / (y - t)) / (z - y));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-2d+36)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else
        tmp = 1.0d0 + ((x / (y - t)) / (z - y))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -2e+36) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else {
		tmp = 1.0 + ((x / (y - t)) / (z - y));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if z <= -2e+36:
		tmp = 1.0 + ((x / z) / (y - t))
	else:
		tmp = 1.0 + ((x / (y - t)) / (z - y))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -2e+36)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	else
		tmp = Float64(1.0 + Float64(Float64(x / Float64(y - t)) / Float64(z - y)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -2e+36)
		tmp = 1.0 + ((x / z) / (y - t));
	else
		tmp = 1.0 + ((x / (y - t)) / (z - y));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[z, -2e+36], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+36}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.00000000000000008e36

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg99.9%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity99.9%

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

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

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-1100.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg100.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-1100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub0100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub0100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified100.0%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified100.0%

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

    if -2.00000000000000008e36 < z

    1. Initial program 96.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg96.0%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity96.0%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.0%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.0%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.0%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-198.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg98.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-198.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub098.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-98.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub098.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative98.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg98.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.0%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num98.0%

        \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
      2. inv-pow98.0%

        \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
      3. div-inv98.0%

        \[\leadsto 1 + {\color{blue}{\left(\left(y - t\right) \cdot \frac{1}{\frac{x}{z - y}}\right)}}^{-1} \]
      4. clear-num98.7%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    8. Simplified98.7%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    9. Taylor expanded in x around 0 96.0%

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    11. Simplified99.4%

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

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

Alternative 2: 91.1% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{x}{y - t}\\ \mathbf{if}\;z \leq -2.3 \cdot 10^{-22}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-88}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-125} \lor \neg \left(z \leq 7.5 \cdot 10^{-79}\right):\\ \;\;\;\;1 + \frac{t\_1}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{t\_1}{y}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ x (- y t))))
   (if (<= z -2.3e-22)
     (+ 1.0 (/ (/ x z) (- y t)))
     (if (<= z -1.02e-88)
       (- 1.0 (/ x (* y (- y z))))
       (if (or (<= z -1.95e-125) (not (<= z 7.5e-79)))
         (+ 1.0 (/ t_1 z))
         (- 1.0 (/ t_1 y)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = x / (y - t);
	double tmp;
	if (z <= -2.3e-22) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (z <= -1.02e-88) {
		tmp = 1.0 - (x / (y * (y - z)));
	} else if ((z <= -1.95e-125) || !(z <= 7.5e-79)) {
		tmp = 1.0 + (t_1 / z);
	} else {
		tmp = 1.0 - (t_1 / y);
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 / (y - t)
    if (z <= (-2.3d-22)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else if (z <= (-1.02d-88)) then
        tmp = 1.0d0 - (x / (y * (y - z)))
    else if ((z <= (-1.95d-125)) .or. (.not. (z <= 7.5d-79))) then
        tmp = 1.0d0 + (t_1 / z)
    else
        tmp = 1.0d0 - (t_1 / y)
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = x / (y - t);
	double tmp;
	if (z <= -2.3e-22) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (z <= -1.02e-88) {
		tmp = 1.0 - (x / (y * (y - z)));
	} else if ((z <= -1.95e-125) || !(z <= 7.5e-79)) {
		tmp = 1.0 + (t_1 / z);
	} else {
		tmp = 1.0 - (t_1 / y);
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = x / (y - t)
	tmp = 0
	if z <= -2.3e-22:
		tmp = 1.0 + ((x / z) / (y - t))
	elif z <= -1.02e-88:
		tmp = 1.0 - (x / (y * (y - z)))
	elif (z <= -1.95e-125) or not (z <= 7.5e-79):
		tmp = 1.0 + (t_1 / z)
	else:
		tmp = 1.0 - (t_1 / y)
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(x / Float64(y - t))
	tmp = 0.0
	if (z <= -2.3e-22)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	elseif (z <= -1.02e-88)
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z))));
	elseif ((z <= -1.95e-125) || !(z <= 7.5e-79))
		tmp = Float64(1.0 + Float64(t_1 / z));
	else
		tmp = Float64(1.0 - Float64(t_1 / y));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = x / (y - t);
	tmp = 0.0;
	if (z <= -2.3e-22)
		tmp = 1.0 + ((x / z) / (y - t));
	elseif (z <= -1.02e-88)
		tmp = 1.0 - (x / (y * (y - z)));
	elseif ((z <= -1.95e-125) || ~((z <= 7.5e-79)))
		tmp = 1.0 + (t_1 / z);
	else
		tmp = 1.0 - (t_1 / y);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.3e-22], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.02e-88], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.95e-125], N[Not[LessEqual[z, 7.5e-79]], $MachinePrecision]], N[(1.0 + N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{y - t}\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{-22}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

\mathbf{elif}\;z \leq -1.02 \cdot 10^{-88}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\

\mathbf{elif}\;z \leq -1.95 \cdot 10^{-125} \lor \neg \left(z \leq 7.5 \cdot 10^{-79}\right):\\
\;\;\;\;1 + \frac{t\_1}{z}\\

\mathbf{else}:\\
\;\;\;\;1 - \frac{t\_1}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.2999999999999998e-22

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg99.9%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity99.9%

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

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

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-1100.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg100.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-1100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub0100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub0100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified100.0%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified97.4%

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

    if -2.2999999999999998e-22 < z < -1.02000000000000001e-88

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 73.8%

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

    if -1.02000000000000001e-88 < z < -1.94999999999999991e-125 or 7.49999999999999969e-79 < z

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg99.9%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity99.9%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-198.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg98.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-198.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub098.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub098.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.9%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified98.1%

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

        \[\leadsto 1 + \color{blue}{\frac{x}{\left(y - t\right) \cdot z}} \]
      2. div-inv99.1%

        \[\leadsto 1 + \color{blue}{x \cdot \frac{1}{\left(y - t\right) \cdot z}} \]
    9. Applied egg-rr99.1%

      \[\leadsto 1 + \color{blue}{x \cdot \frac{1}{\left(y - t\right) \cdot z}} \]
    10. Step-by-step derivation
      1. un-div-inv99.1%

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z}} \]
    11. Applied egg-rr98.1%

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

    if -1.94999999999999991e-125 < z < 7.49999999999999969e-79

    1. Initial program 90.8%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 85.0%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - t\right)}} \]
    4. Step-by-step derivation
      1. div-inv85.0%

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

        \[\leadsto 1 - x \cdot \color{blue}{\frac{\frac{1}{y}}{y - t}} \]
    5. Applied egg-rr85.0%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{1}{y} \cdot \frac{x}{y - t}} \]
      4. associate-*l/88.4%

        \[\leadsto 1 - \color{blue}{\frac{1 \cdot \frac{x}{y - t}}{y}} \]
      5. *-lft-identity88.4%

        \[\leadsto 1 - \frac{\color{blue}{\frac{x}{y - t}}}{y} \]
    7. Simplified88.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{-22}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-88}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-125} \lor \neg \left(z \leq 7.5 \cdot 10^{-79}\right):\\ \;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.1% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := 1 - \frac{x}{t \cdot z}\\ \mathbf{if}\;z \leq -9.5 \cdot 10^{+76}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{-88}:\\ \;\;\;\;1 + \frac{x}{y \cdot z}\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-80}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- 1.0 (/ x (* t z)))))
   (if (<= z -9.5e+76)
     t_1
     (if (<= z -2.25e-88)
       (+ 1.0 (/ x (* y z)))
       (if (<= z 3.1e-80) (+ 1.0 (/ (/ x t) y)) t_1)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = 1.0 - (x / (t * z));
	double tmp;
	if (z <= -9.5e+76) {
		tmp = t_1;
	} else if (z <= -2.25e-88) {
		tmp = 1.0 + (x / (y * z));
	} else if (z <= 3.1e-80) {
		tmp = 1.0 + ((x / t) / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 - (x / (t * z))
    if (z <= (-9.5d+76)) then
        tmp = t_1
    else if (z <= (-2.25d-88)) then
        tmp = 1.0d0 + (x / (y * z))
    else if (z <= 3.1d-80) then
        tmp = 1.0d0 + ((x / t) / y)
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = 1.0 - (x / (t * z));
	double tmp;
	if (z <= -9.5e+76) {
		tmp = t_1;
	} else if (z <= -2.25e-88) {
		tmp = 1.0 + (x / (y * z));
	} else if (z <= 3.1e-80) {
		tmp = 1.0 + ((x / t) / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = 1.0 - (x / (t * z))
	tmp = 0
	if z <= -9.5e+76:
		tmp = t_1
	elif z <= -2.25e-88:
		tmp = 1.0 + (x / (y * z))
	elif z <= 3.1e-80:
		tmp = 1.0 + ((x / t) / y)
	else:
		tmp = t_1
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(1.0 - Float64(x / Float64(t * z)))
	tmp = 0.0
	if (z <= -9.5e+76)
		tmp = t_1;
	elseif (z <= -2.25e-88)
		tmp = Float64(1.0 + Float64(x / Float64(y * z)));
	elseif (z <= 3.1e-80)
		tmp = Float64(1.0 + Float64(Float64(x / t) / y));
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = 1.0 - (x / (t * z));
	tmp = 0.0;
	if (z <= -9.5e+76)
		tmp = t_1;
	elseif (z <= -2.25e-88)
		tmp = 1.0 + (x / (y * z));
	elseif (z <= 3.1e-80)
		tmp = 1.0 + ((x / t) / y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+76], t$95$1, If[LessEqual[z, -2.25e-88], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e-80], N[(1.0 + N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{t \cdot z}\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2.25 \cdot 10^{-88}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\

\mathbf{elif}\;z \leq 3.1 \cdot 10^{-80}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.5000000000000003e76 or 3.10000000000000016e-80 < z

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 86.2%

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

    if -9.5000000000000003e76 < z < -2.24999999999999996e-88

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg99.9%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity99.9%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/94.2%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval94.2%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac94.2%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-194.2%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg94.2%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-194.2%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub094.2%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-94.2%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub094.2%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative94.2%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg94.2%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified94.2%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified85.7%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    8. Taylor expanded in y around inf 59.8%

      \[\leadsto 1 + \color{blue}{\frac{x}{y \cdot z}} \]
    9. Step-by-step derivation
      1. *-commutative59.8%

        \[\leadsto 1 + \frac{x}{\color{blue}{z \cdot y}} \]
    10. Simplified59.8%

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

    if -2.24999999999999996e-88 < z < 3.10000000000000016e-80

    1. Initial program 91.2%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg91.2%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity91.2%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/97.8%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval97.8%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac97.8%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-197.8%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg97.8%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-197.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub097.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-97.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub097.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative97.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg97.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified97.8%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num97.7%

        \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
      2. inv-pow97.7%

        \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
      3. div-inv97.7%

        \[\leadsto 1 + {\color{blue}{\left(\left(y - t\right) \cdot \frac{1}{\frac{x}{z - y}}\right)}}^{-1} \]
      4. clear-num98.7%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    8. Simplified98.7%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    9. Taylor expanded in x around 0 91.2%

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

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

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    12. Taylor expanded in t around inf 71.8%

      \[\leadsto 1 + \color{blue}{-1 \cdot \frac{x}{t \cdot \left(z - y\right)}} \]
    13. Step-by-step derivation
      1. mul-1-neg71.8%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{\frac{x}{t}}{z - y}}\right) \]
      3. distribute-neg-frac75.1%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
      4. distribute-neg-frac75.1%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
    14. Simplified75.1%

      \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
    15. Taylor expanded in z around 0 64.9%

      \[\leadsto 1 + \color{blue}{\frac{x}{t \cdot y}} \]
    16. Step-by-step derivation
      1. associate-/r*65.1%

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{t}}{y}} \]
    17. Simplified65.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+76}:\\ \;\;\;\;1 - \frac{x}{t \cdot z}\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{-88}:\\ \;\;\;\;1 + \frac{x}{y \cdot z}\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-80}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{t \cdot z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.5% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -1.25 \cdot 10^{-275}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;t \leq 2.5 \cdot 10^{-120}:\\ \;\;\;\;1 + \frac{\frac{1}{y}}{\frac{z - y}{x}}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.25e-275)
   (+ 1.0 (/ (/ x z) (- y t)))
   (if (<= t 2.5e-120)
     (+ 1.0 (/ (/ 1.0 y) (/ (- z y) x)))
     (- 1.0 (/ (/ x t) (- z y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.25e-275) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 2.5e-120) {
		tmp = 1.0 + ((1.0 / y) / ((z - y) / x));
	} else {
		tmp = 1.0 - ((x / t) / (z - y));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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.25d-275)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else if (t <= 2.5d-120) then
        tmp = 1.0d0 + ((1.0d0 / y) / ((z - y) / x))
    else
        tmp = 1.0d0 - ((x / t) / (z - y))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.25e-275) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 2.5e-120) {
		tmp = 1.0 + ((1.0 / y) / ((z - y) / x));
	} else {
		tmp = 1.0 - ((x / t) / (z - y));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if t <= -1.25e-275:
		tmp = 1.0 + ((x / z) / (y - t))
	elif t <= 2.5e-120:
		tmp = 1.0 + ((1.0 / y) / ((z - y) / x))
	else:
		tmp = 1.0 - ((x / t) / (z - y))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.25e-275)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	elseif (t <= 2.5e-120)
		tmp = Float64(1.0 + Float64(Float64(1.0 / y) / Float64(Float64(z - y) / x)));
	else
		tmp = Float64(1.0 - Float64(Float64(x / t) / Float64(z - y)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.25e-275)
		tmp = 1.0 + ((x / z) / (y - t));
	elseif (t <= 2.5e-120)
		tmp = 1.0 + ((1.0 / y) / ((z - y) / x));
	else
		tmp = 1.0 - ((x / t) / (z - y));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[t, -1.25e-275], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.5e-120], N[(1.0 + N[(N[(1.0 / y), $MachinePrecision] / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{-275}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

\mathbf{elif}\;t \leq 2.5 \cdot 10^{-120}:\\
\;\;\;\;1 + \frac{\frac{1}{y}}{\frac{z - y}{x}}\\

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


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

    1. Initial program 98.3%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg98.3%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity98.3%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/97.7%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval97.7%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac97.7%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-197.7%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg97.7%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-197.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub097.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-97.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub097.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative97.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg97.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified97.7%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified79.4%

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

    if -1.24999999999999996e-275 < t < 2.50000000000000003e-120

    1. Initial program 86.1%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg86.1%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity86.1%

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

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

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-1100.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg100.0%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-1100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub0100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub0100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg100.0%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.9%

        \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
      2. inv-pow99.9%

        \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
      3. div-inv99.9%

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

        \[\leadsto 1 + {\left(\left(y - t\right) \cdot \color{blue}{\frac{z - y}{x}}\right)}^{-1} \]
    6. Applied egg-rr99.9%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    8. Simplified99.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    9. Taylor expanded in y around inf 94.3%

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

    if 2.50000000000000003e-120 < t

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg99.9%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity99.9%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-198.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg98.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-198.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub098.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub098.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num98.8%

        \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
      2. inv-pow98.8%

        \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
      3. div-inv98.8%

        \[\leadsto 1 + {\color{blue}{\left(\left(y - t\right) \cdot \frac{1}{\frac{x}{z - y}}\right)}}^{-1} \]
      4. clear-num99.8%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    8. Simplified99.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    9. Taylor expanded in t around inf 94.4%

      \[\leadsto 1 + \color{blue}{-1 \cdot \frac{x}{t \cdot \left(z - y\right)}} \]
    10. Step-by-step derivation
      1. mul-1-neg94.4%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{\frac{x}{t}}{z - y}}\right) \]
    11. Simplified94.4%

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

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

Alternative 5: 86.9% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+16} \lor \neg \left(y \leq 3.4 \cdot 10^{-8}\right):\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -3.4e+16) (not (<= y 3.4e-8)))
   (- 1.0 (/ (/ x y) y))
   (+ 1.0 (/ (/ x z) (- y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.4e+16) || !(y <= 3.4e-8)) {
		tmp = 1.0 - ((x / y) / y);
	} else {
		tmp = 1.0 + ((x / z) / (y - t));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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+16)) .or. (.not. (y <= 3.4d-8))) then
        tmp = 1.0d0 - ((x / y) / y)
    else
        tmp = 1.0d0 + ((x / z) / (y - t))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.4e+16) || !(y <= 3.4e-8)) {
		tmp = 1.0 - ((x / y) / y);
	} else {
		tmp = 1.0 + ((x / z) / (y - t));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if (y <= -3.4e+16) or not (y <= 3.4e-8):
		tmp = 1.0 - ((x / y) / y)
	else:
		tmp = 1.0 + ((x / z) / (y - t))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -3.4e+16) || !(y <= 3.4e-8))
		tmp = Float64(1.0 - Float64(Float64(x / y) / y));
	else
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -3.4e+16) || ~((y <= 3.4e-8)))
		tmp = 1.0 - ((x / y) / y);
	else
		tmp = 1.0 + ((x / z) / (y - t));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.4e+16], N[Not[LessEqual[y, 3.4e-8]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+16} \lor \neg \left(y \leq 3.4 \cdot 10^{-8}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.4e16 or 3.4e-8 < y

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.2%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - t\right)}} \]
    4. Step-by-step derivation
      1. div-inv98.2%

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

        \[\leadsto 1 - x \cdot \color{blue}{\frac{\frac{1}{y}}{y - t}} \]
    5. Applied egg-rr98.2%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{1}{y} \cdot \frac{x}{y - t}} \]
      4. associate-*l/98.2%

        \[\leadsto 1 - \color{blue}{\frac{1 \cdot \frac{x}{y - t}}{y}} \]
      5. *-lft-identity98.2%

        \[\leadsto 1 - \frac{\color{blue}{\frac{x}{y - t}}}{y} \]
    7. Simplified98.2%

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y - t}}{y}} \]
    8. Taylor expanded in y around inf 94.6%

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

    if -3.4e16 < y < 3.4e-8

    1. Initial program 93.7%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg93.7%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg93.7%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity93.7%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/96.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval96.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac96.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-196.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg96.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-196.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub096.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-96.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub096.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative96.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg96.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified96.9%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified82.0%

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

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

Alternative 6: 89.3% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{-28} \lor \neg \left(y \leq 1.6 \cdot 10^{-63}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -3.5e-28) (not (<= y 1.6e-63)))
   (- 1.0 (/ x (* y (- y t))))
   (+ 1.0 (/ (/ x z) (- y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.5e-28) || !(y <= 1.6e-63)) {
		tmp = 1.0 - (x / (y * (y - t)));
	} else {
		tmp = 1.0 + ((x / z) / (y - t));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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.5d-28)) .or. (.not. (y <= 1.6d-63))) then
        tmp = 1.0d0 - (x / (y * (y - t)))
    else
        tmp = 1.0d0 + ((x / z) / (y - t))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.5e-28) || !(y <= 1.6e-63)) {
		tmp = 1.0 - (x / (y * (y - t)));
	} else {
		tmp = 1.0 + ((x / z) / (y - t));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if (y <= -3.5e-28) or not (y <= 1.6e-63):
		tmp = 1.0 - (x / (y * (y - t)))
	else:
		tmp = 1.0 + ((x / z) / (y - t))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -3.5e-28) || !(y <= 1.6e-63))
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t))));
	else
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -3.5e-28) || ~((y <= 1.6e-63)))
		tmp = 1.0 - (x / (y * (y - t)));
	else
		tmp = 1.0 + ((x / z) / (y - t));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.5e-28], N[Not[LessEqual[y, 1.6e-63]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-28} \lor \neg \left(y \leq 1.6 \cdot 10^{-63}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.5e-28 or 1.59999999999999994e-63 < y

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 94.9%

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

    if -3.5e-28 < y < 1.59999999999999994e-63

    1. Initial program 92.6%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg92.6%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg92.6%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity92.6%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/96.4%

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

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac96.4%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-196.4%

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

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-196.4%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub096.4%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-96.4%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub096.4%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative96.4%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg96.4%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified96.4%

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

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

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

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

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

Alternative 7: 89.4% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{-81}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{-62}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= y -6.8e-81)
   (- 1.0 (/ x (* y (- y z))))
   (if (<= y 2.7e-62)
     (+ 1.0 (/ (/ x z) (- y t)))
     (- 1.0 (/ x (* y (- y t)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -6.8e-81) {
		tmp = 1.0 - (x / (y * (y - z)));
	} else if (y <= 2.7e-62) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else {
		tmp = 1.0 - (x / (y * (y - t)));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-6.8d-81)) then
        tmp = 1.0d0 - (x / (y * (y - z)))
    else if (y <= 2.7d-62) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else
        tmp = 1.0d0 - (x / (y * (y - t)))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -6.8e-81) {
		tmp = 1.0 - (x / (y * (y - z)));
	} else if (y <= 2.7e-62) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else {
		tmp = 1.0 - (x / (y * (y - t)));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -6.8e-81:
		tmp = 1.0 - (x / (y * (y - z)))
	elif y <= 2.7e-62:
		tmp = 1.0 + ((x / z) / (y - t))
	else:
		tmp = 1.0 - (x / (y * (y - t)))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -6.8e-81)
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z))));
	elseif (y <= 2.7e-62)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	else
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -6.8e-81)
		tmp = 1.0 - (x / (y * (y - z)));
	elseif (y <= 2.7e-62)
		tmp = 1.0 + ((x / z) / (y - t));
	else
		tmp = 1.0 - (x / (y * (y - t)));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[y, -6.8e-81], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e-62], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{-81}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\

\mathbf{elif}\;y \leq 2.7 \cdot 10^{-62}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.7999999999999997e-81

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 96.3%

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

    if -6.7999999999999997e-81 < y < 2.70000000000000019e-62

    1. Initial program 91.7%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg91.7%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg91.7%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity91.7%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/95.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval95.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac95.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-195.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg95.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-195.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub095.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-95.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub095.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative95.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg95.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified95.9%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified85.1%

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

    if 2.70000000000000019e-62 < y

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 94.4%

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

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

Alternative 8: 92.4% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -1.35 \cdot 10^{-272}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;t \leq 1.25 \cdot 10^{-116}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.35e-272)
   (+ 1.0 (/ (/ x z) (- y t)))
   (if (<= t 1.25e-116)
     (- 1.0 (/ x (* y (- y z))))
     (- 1.0 (/ (/ x t) (- z y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.35e-272) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 1.25e-116) {
		tmp = 1.0 - (x / (y * (y - z)));
	} else {
		tmp = 1.0 - ((x / t) / (z - y));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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.35d-272)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else if (t <= 1.25d-116) then
        tmp = 1.0d0 - (x / (y * (y - z)))
    else
        tmp = 1.0d0 - ((x / t) / (z - y))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.35e-272) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 1.25e-116) {
		tmp = 1.0 - (x / (y * (y - z)));
	} else {
		tmp = 1.0 - ((x / t) / (z - y));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if t <= -1.35e-272:
		tmp = 1.0 + ((x / z) / (y - t))
	elif t <= 1.25e-116:
		tmp = 1.0 - (x / (y * (y - z)))
	else:
		tmp = 1.0 - ((x / t) / (z - y))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.35e-272)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	elseif (t <= 1.25e-116)
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z))));
	else
		tmp = Float64(1.0 - Float64(Float64(x / t) / Float64(z - y)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.35e-272)
		tmp = 1.0 + ((x / z) / (y - t));
	elseif (t <= 1.25e-116)
		tmp = 1.0 - (x / (y * (y - z)));
	else
		tmp = 1.0 - ((x / t) / (z - y));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[t, -1.35e-272], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.25e-116], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-272}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

\mathbf{elif}\;t \leq 1.25 \cdot 10^{-116}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\

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


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

    1. Initial program 98.2%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg98.2%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity98.2%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/97.7%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval97.7%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac97.7%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-197.7%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg97.7%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-197.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub097.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-97.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub097.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative97.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg97.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified97.7%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified80.0%

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

    if -1.34999999999999996e-272 < t < 1.2500000000000001e-116

    1. Initial program 86.5%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 84.3%

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

    if 1.2500000000000001e-116 < t

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg99.9%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity99.9%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-198.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg98.9%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-198.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub098.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub098.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num98.8%

        \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
      2. inv-pow98.8%

        \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
      3. div-inv98.8%

        \[\leadsto 1 + {\color{blue}{\left(\left(y - t\right) \cdot \frac{1}{\frac{x}{z - y}}\right)}}^{-1} \]
      4. clear-num99.8%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    8. Simplified99.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    9. Taylor expanded in t around inf 94.4%

      \[\leadsto 1 + \color{blue}{-1 \cdot \frac{x}{t \cdot \left(z - y\right)}} \]
    10. Step-by-step derivation
      1. mul-1-neg94.4%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{\frac{x}{t}}{z - y}}\right) \]
    11. Simplified94.4%

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

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

Alternative 9: 81.8% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -11800 \lor \neg \left(y \leq 1.68 \cdot 10^{-9}\right):\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{t \cdot z}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -11800.0) (not (<= y 1.68e-9)))
   (- 1.0 (/ (/ x y) y))
   (- 1.0 (/ x (* t z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -11800.0) || !(y <= 1.68e-9)) {
		tmp = 1.0 - ((x / y) / y);
	} else {
		tmp = 1.0 - (x / (t * z));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-11800.0d0)) .or. (.not. (y <= 1.68d-9))) then
        tmp = 1.0d0 - ((x / y) / y)
    else
        tmp = 1.0d0 - (x / (t * z))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -11800.0) || !(y <= 1.68e-9)) {
		tmp = 1.0 - ((x / y) / y);
	} else {
		tmp = 1.0 - (x / (t * z));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if (y <= -11800.0) or not (y <= 1.68e-9):
		tmp = 1.0 - ((x / y) / y)
	else:
		tmp = 1.0 - (x / (t * z))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -11800.0) || !(y <= 1.68e-9))
		tmp = Float64(1.0 - Float64(Float64(x / y) / y));
	else
		tmp = Float64(1.0 - Float64(x / Float64(t * z)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -11800.0) || ~((y <= 1.68e-9)))
		tmp = 1.0 - ((x / y) / y);
	else
		tmp = 1.0 - (x / (t * z));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -11800.0], N[Not[LessEqual[y, 1.68e-9]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -11800 \lor \neg \left(y \leq 1.68 \cdot 10^{-9}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -11800 or 1.68e-9 < y

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 97.9%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - t\right)}} \]
    4. Step-by-step derivation
      1. div-inv97.9%

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

        \[\leadsto 1 - x \cdot \color{blue}{\frac{\frac{1}{y}}{y - t}} \]
    5. Applied egg-rr97.9%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{1}{y} \cdot \frac{x}{y - t}} \]
      4. associate-*l/97.9%

        \[\leadsto 1 - \color{blue}{\frac{1 \cdot \frac{x}{y - t}}{y}} \]
      5. *-lft-identity97.9%

        \[\leadsto 1 - \frac{\color{blue}{\frac{x}{y - t}}}{y} \]
    7. Simplified97.9%

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y - t}}{y}} \]
    8. Taylor expanded in y around inf 94.4%

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

    if -11800 < y < 1.68e-9

    1. Initial program 93.6%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.0%

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

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

Alternative 10: 81.6% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{-7} \lor \neg \left(y \leq 9 \cdot 10^{-10}\right):\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -2.7e-7) (not (<= y 9e-10)))
   (- 1.0 (/ (/ x y) y))
   (- 1.0 (/ (/ x z) t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -2.7e-7) || !(y <= 9e-10)) {
		tmp = 1.0 - ((x / y) / y);
	} else {
		tmp = 1.0 - ((x / z) / t);
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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.7d-7)) .or. (.not. (y <= 9d-10))) then
        tmp = 1.0d0 - ((x / y) / y)
    else
        tmp = 1.0d0 - ((x / z) / t)
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -2.7e-7) || !(y <= 9e-10)) {
		tmp = 1.0 - ((x / y) / y);
	} else {
		tmp = 1.0 - ((x / z) / t);
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if (y <= -2.7e-7) or not (y <= 9e-10):
		tmp = 1.0 - ((x / y) / y)
	else:
		tmp = 1.0 - ((x / z) / t)
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -2.7e-7) || !(y <= 9e-10))
		tmp = Float64(1.0 - Float64(Float64(x / y) / y));
	else
		tmp = Float64(1.0 - Float64(Float64(x / z) / t));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -2.7e-7) || ~((y <= 9e-10)))
		tmp = 1.0 - ((x / y) / y);
	else
		tmp = 1.0 - ((x / z) / t);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.7e-7], N[Not[LessEqual[y, 9e-10]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-7} \lor \neg \left(y \leq 9 \cdot 10^{-10}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.70000000000000009e-7 or 8.9999999999999999e-10 < y

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 97.2%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - t\right)}} \]
    4. Step-by-step derivation
      1. div-inv97.1%

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

        \[\leadsto 1 - x \cdot \color{blue}{\frac{\frac{1}{y}}{y - t}} \]
    5. Applied egg-rr97.1%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{1}{y} \cdot \frac{x}{y - t}} \]
      4. associate-*l/97.1%

        \[\leadsto 1 - \color{blue}{\frac{1 \cdot \frac{x}{y - t}}{y}} \]
      5. *-lft-identity97.1%

        \[\leadsto 1 - \frac{\color{blue}{\frac{x}{y - t}}}{y} \]
    7. Simplified97.1%

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y - t}}{y}} \]
    8. Taylor expanded in y around inf 93.7%

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

    if -2.70000000000000009e-7 < y < 8.9999999999999999e-10

    1. Initial program 93.5%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg93.5%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity93.5%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/96.8%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval96.8%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac96.8%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-196.8%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg96.8%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-196.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub096.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-96.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub096.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative96.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg96.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified96.8%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num96.8%

        \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
      2. inv-pow96.8%

        \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
      3. div-inv96.7%

        \[\leadsto 1 + {\color{blue}{\left(\left(y - t\right) \cdot \frac{1}{\frac{x}{z - y}}\right)}}^{-1} \]
      4. clear-num97.8%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    8. Simplified97.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    9. Taylor expanded in x around 0 93.5%

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    11. Simplified96.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    12. Taylor expanded in t around inf 81.0%

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

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{\frac{x}{t}}{z - y}}\right) \]
      3. distribute-neg-frac81.1%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
      4. distribute-neg-frac81.1%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
    14. Simplified81.1%

      \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
    15. Taylor expanded in z around inf 72.6%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{-1 \cdot x}{z}}{t}} \]
      4. neg-mul-171.4%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-x}}{z}}{t} \]
    17. Simplified71.4%

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

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

Alternative 11: 98.5% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ 1 + \frac{\frac{1}{y - t}}{\frac{z - y}{x}} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (+ 1.0 (/ (/ 1.0 (- y t)) (/ (- z y) x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 1.0 + ((1.0 / (y - t)) / ((z - y) / x));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 = 1.0d0 + ((1.0d0 / (y - t)) / ((z - y) / x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 + ((1.0 / (y - t)) / ((z - y) / x));
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return 1.0 + ((1.0 / (y - t)) / ((z - y) / x))
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(1.0 + Float64(Float64(1.0 / Float64(y - t)) / Float64(Float64(z - y) / x)))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 + ((1.0 / (y - t)) / ((z - y) / x));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(1.0 + N[(N[(1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{1}{y - t}}{\frac{z - y}{x}}
\end{array}
Derivation
  1. Initial program 96.9%

    \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
  2. Step-by-step derivation
    1. sub-neg96.9%

      \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
    2. distribute-frac-neg96.9%

      \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
    3. *-lft-identity96.9%

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

      \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
    5. associate-*r/98.5%

      \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
    6. metadata-eval98.5%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
    7. times-frac98.5%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
    8. neg-mul-198.5%

      \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
    9. remove-double-neg98.5%

      \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
    10. neg-mul-198.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
    11. neg-sub098.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
    12. associate-+l-98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
    13. neg-sub098.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
    14. +-commutative98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
    15. sub-neg98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
  3. Simplified98.5%

    \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-num98.4%

      \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
    2. inv-pow98.4%

      \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
    3. div-inv98.4%

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

      \[\leadsto 1 + {\left(\left(y - t\right) \cdot \color{blue}{\frac{z - y}{x}}\right)}^{-1} \]
  6. Applied egg-rr98.9%

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

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

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
  8. Simplified98.9%

    \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
  9. Final simplification98.9%

    \[\leadsto 1 + \frac{\frac{1}{y - t}}{\frac{z - y}{x}} \]
  10. Add Preprocessing

Alternative 12: 71.6% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 9.5 \cdot 10^{-82}:\\ \;\;\;\;1 + \frac{x}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{y \cdot t}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= t 9.5e-82) (+ 1.0 (/ x (* y z))) (+ 1.0 (/ x (* y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 9.5e-82) {
		tmp = 1.0 + (x / (y * z));
	} else {
		tmp = 1.0 + (x / (y * t));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= 9.5d-82) then
        tmp = 1.0d0 + (x / (y * z))
    else
        tmp = 1.0d0 + (x / (y * t))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 9.5e-82) {
		tmp = 1.0 + (x / (y * z));
	} else {
		tmp = 1.0 + (x / (y * t));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if t <= 9.5e-82:
		tmp = 1.0 + (x / (y * z))
	else:
		tmp = 1.0 + (x / (y * t))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (t <= 9.5e-82)
		tmp = Float64(1.0 + Float64(x / Float64(y * z)));
	else
		tmp = Float64(1.0 + Float64(x / Float64(y * t)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= 9.5e-82)
		tmp = 1.0 + (x / (y * z));
	else
		tmp = 1.0 + (x / (y * t));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[t, 9.5e-82], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.5 \cdot 10^{-82}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\

\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 9.4999999999999996e-82

    1. Initial program 95.5%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg95.5%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity95.5%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.3%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.3%

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

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-198.3%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg98.3%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-198.3%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub098.3%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-98.3%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub098.3%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative98.3%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg98.3%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.3%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified78.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    8. Taylor expanded in y around inf 59.6%

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

        \[\leadsto 1 + \frac{x}{\color{blue}{z \cdot y}} \]
    10. Simplified59.6%

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

    if 9.4999999999999996e-82 < t

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
      2. distribute-frac-neg99.9%

        \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
      3. *-lft-identity99.9%

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.7%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.7%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.7%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      8. neg-mul-198.7%

        \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      9. remove-double-neg98.7%

        \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
      10. neg-mul-198.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. neg-sub098.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
      12. associate-+l-98.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
      13. neg-sub098.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
      14. +-commutative98.7%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg98.7%

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

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num98.7%

        \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
      2. inv-pow98.7%

        \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
      3. div-inv98.7%

        \[\leadsto 1 + {\color{blue}{\left(\left(y - t\right) \cdot \frac{1}{\frac{x}{z - y}}\right)}}^{-1} \]
      4. clear-num99.8%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    8. Simplified99.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
    9. Taylor expanded in x around 0 99.9%

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

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

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    12. Taylor expanded in t around inf 98.7%

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

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{\frac{x}{t}}{z - y}}\right) \]
      3. distribute-neg-frac98.7%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
      4. distribute-neg-frac98.7%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
    14. Simplified98.7%

      \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
    15. Taylor expanded in z around 0 74.3%

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

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

Alternative 13: 98.4% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ 1 + \frac{\frac{x}{z - y}}{y - t} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ (/ x (- z y)) (- y t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 1.0 + ((x / (z - y)) / (y - t));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 = 1.0d0 + ((x / (z - y)) / (y - t))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 + ((x / (z - y)) / (y - t));
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return 1.0 + ((x / (z - y)) / (y - t))
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t)))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 + ((x / (z - y)) / (y - t));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{x}{z - y}}{y - t}
\end{array}
Derivation
  1. Initial program 96.9%

    \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
  2. Step-by-step derivation
    1. sub-neg96.9%

      \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
    2. distribute-frac-neg96.9%

      \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
    3. *-lft-identity96.9%

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

      \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
    5. associate-*r/98.5%

      \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
    6. metadata-eval98.5%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
    7. times-frac98.5%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
    8. neg-mul-198.5%

      \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
    9. remove-double-neg98.5%

      \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
    10. neg-mul-198.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
    11. neg-sub098.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
    12. associate-+l-98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
    13. neg-sub098.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
    14. +-commutative98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
    15. sub-neg98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
  3. Simplified98.5%

    \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
  4. Add Preprocessing
  5. Final simplification98.5%

    \[\leadsto 1 + \frac{\frac{x}{z - y}}{y - t} \]
  6. Add Preprocessing

Alternative 14: 56.8% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ 1 + \frac{x}{y \cdot t} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* y t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 1.0 + (x / (y * t));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 = 1.0d0 + (x / (y * t))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 + (x / (y * t));
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return 1.0 + (x / (y * t))
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(1.0 + Float64(x / Float64(y * t)))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 + (x / (y * t));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{x}{y \cdot t}
\end{array}
Derivation
  1. Initial program 96.9%

    \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
  2. Step-by-step derivation
    1. sub-neg96.9%

      \[\leadsto \color{blue}{1 + \left(-\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)} \]
    2. distribute-frac-neg96.9%

      \[\leadsto 1 + \color{blue}{\frac{-x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
    3. *-lft-identity96.9%

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

      \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
    5. associate-*r/98.5%

      \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
    6. metadata-eval98.5%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
    7. times-frac98.5%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-1 \cdot \left(-x\right)}{-1 \cdot \left(y - z\right)}}}{y - t} \]
    8. neg-mul-198.5%

      \[\leadsto 1 + \frac{\frac{\color{blue}{-\left(-x\right)}}{-1 \cdot \left(y - z\right)}}{y - t} \]
    9. remove-double-neg98.5%

      \[\leadsto 1 + \frac{\frac{\color{blue}{x}}{-1 \cdot \left(y - z\right)}}{y - t} \]
    10. neg-mul-198.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
    11. neg-sub098.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{0 - \left(y - z\right)}}}{y - t} \]
    12. associate-+l-98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(0 - y\right) + z}}}{y - t} \]
    13. neg-sub098.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right)} + z}}{y - t} \]
    14. +-commutative98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
    15. sub-neg98.5%

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
  3. Simplified98.5%

    \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-num98.4%

      \[\leadsto 1 + \color{blue}{\frac{1}{\frac{y - t}{\frac{x}{z - y}}}} \]
    2. inv-pow98.4%

      \[\leadsto 1 + \color{blue}{{\left(\frac{y - t}{\frac{x}{z - y}}\right)}^{-1}} \]
    3. div-inv98.4%

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

      \[\leadsto 1 + {\left(\left(y - t\right) \cdot \color{blue}{\frac{z - y}{x}}\right)}^{-1} \]
  6. Applied egg-rr98.9%

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

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

      \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
  8. Simplified98.9%

    \[\leadsto 1 + \color{blue}{\frac{\frac{1}{y - t}}{\frac{z - y}{x}}} \]
  9. Taylor expanded in x around 0 96.9%

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

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
  11. Simplified98.5%

    \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
  12. Taylor expanded in t around inf 80.2%

    \[\leadsto 1 + \color{blue}{-1 \cdot \frac{x}{t \cdot \left(z - y\right)}} \]
  13. Step-by-step derivation
    1. mul-1-neg80.2%

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

      \[\leadsto 1 + \left(-\color{blue}{\frac{\frac{x}{t}}{z - y}}\right) \]
    3. distribute-neg-frac80.2%

      \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
    4. distribute-neg-frac80.2%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
  14. Simplified80.2%

    \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
  15. Taylor expanded in z around 0 57.6%

    \[\leadsto 1 + \color{blue}{\frac{x}{t \cdot y}} \]
  16. Final simplification57.6%

    \[\leadsto 1 + \frac{x}{y \cdot t} \]
  17. Add Preprocessing

Reproduce

?
herbie shell --seed 2024036 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
  :precision binary64
  (- 1.0 (/ x (* (- y z) (- y t)))))