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

Percentage Accurate: 99.3% → 98.4%
Time: 10.7s
Alternatives: 12
Speedup: N/A×

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 12 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.3% 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: 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 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 86.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 -1400:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-90}:\\ \;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;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
 (if (<= y -1400.0) 1.0 (if (<= y 3.8e-90) (+ 1.0 (/ x (* z (- y t)))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1400.0) {
		tmp = 1.0;
	} else if (y <= 3.8e-90) {
		tmp = 1.0 + (x / (z * (y - t)));
	} else {
		tmp = 1.0;
	}
	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 <= (-1400.0d0)) then
        tmp = 1.0d0
    else if (y <= 3.8d-90) then
        tmp = 1.0d0 + (x / (z * (y - t)))
    else
        tmp = 1.0d0
    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 <= -1400.0) {
		tmp = 1.0;
	} else if (y <= 3.8e-90) {
		tmp = 1.0 + (x / (z * (y - t)));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -1400.0:
		tmp = 1.0
	elif y <= 3.8e-90:
		tmp = 1.0 + (x / (z * (y - t)))
	else:
		tmp = 1.0
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1400.0)
		tmp = 1.0;
	elseif (y <= 3.8e-90)
		tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t))));
	else
		tmp = 1.0;
	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 <= -1400.0)
		tmp = 1.0;
	elseif (y <= 3.8e-90)
		tmp = 1.0 + (x / (z * (y - t)));
	else
		tmp = 1.0;
	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, -1400.0], 1.0, If[LessEqual[y, 3.8e-90], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1400:\\
\;\;\;\;1\\

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

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1400 or 3.8e-90 < 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 t around 0 93.3%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
    4. Taylor expanded in x around 0 91.5%

      \[\leadsto \color{blue}{1} \]

    if -1400 < y < 3.8e-90

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.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 -3.05:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-91}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;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
 (if (<= y -3.05) 1.0 (if (<= y 4.8e-91) (+ 1.0 (/ (/ x z) (- y t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.05) {
		tmp = 1.0;
	} else if (y <= 4.8e-91) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else {
		tmp = 1.0;
	}
	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.05d0)) then
        tmp = 1.0d0
    else if (y <= 4.8d-91) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else
        tmp = 1.0d0
    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.05) {
		tmp = 1.0;
	} else if (y <= 4.8e-91) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -3.05:
		tmp = 1.0
	elif y <= 4.8e-91:
		tmp = 1.0 + ((x / z) / (y - t))
	else:
		tmp = 1.0
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -3.05)
		tmp = 1.0;
	elseif (y <= 4.8e-91)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	else
		tmp = 1.0;
	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.05)
		tmp = 1.0;
	elseif (y <= 4.8e-91)
		tmp = 1.0 + ((x / z) / (y - t));
	else
		tmp = 1.0;
	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, -3.05], 1.0, If[LessEqual[y, 4.8e-91], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.05:\\
\;\;\;\;1\\

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

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.0499999999999998 or 4.80000000000000022e-91 < 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 t around 0 93.3%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
    4. Taylor expanded in x around 0 91.5%

      \[\leadsto \color{blue}{1} \]

    if -3.0499999999999998 < y < 4.80000000000000022e-91

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 92.6% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{-97}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;z \leq 3.25 \cdot 10^{-142}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{\left(z - y\right) \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 (<= z -2.9e-97)
   (+ 1.0 (/ (/ x z) (- y t)))
   (if (<= z 3.25e-142)
     (- 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 (z <= -2.9e-97) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (z <= 3.25e-142) {
		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 (z <= (-2.9d-97)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else if (z <= 3.25d-142) 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 (z <= -2.9e-97) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (z <= 3.25e-142) {
		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 z <= -2.9e-97:
		tmp = 1.0 + ((x / z) / (y - t))
	elif z <= 3.25e-142:
		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 (z <= -2.9e-97)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	elseif (z <= 3.25e-142)
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t))));
	else
		tmp = Float64(1.0 - Float64(x / Float64(Float64(z - 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 (z <= -2.9e-97)
		tmp = 1.0 + ((x / z) / (y - t));
	elseif (z <= 3.25e-142)
		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[LessEqual[z, -2.9e-97], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.25e-142], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(N[(z - y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-97}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.8999999999999999e-97

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8999999999999999e-97 < z < 3.25000000000000013e-142

    1. Initial program 96.4%

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

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

    if 3.25000000000000013e-142 < z

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{\frac{x}{t}}{\left(-y\right) + \left(-\color{blue}{\sqrt{z} \cdot \sqrt{z}}\right)} \]
      13. add-sqr-sqrt76.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 92.6% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -2.75 \cdot 10^{-97}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-144}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\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 (<= z -2.75e-97)
   (+ 1.0 (/ (/ x z) (- y t)))
   (if (<= z 4.1e-144)
     (- 1.0 (/ x (* y (- y t))))
     (- 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 (z <= -2.75e-97) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (z <= 4.1e-144) {
		tmp = 1.0 - (x / (y * (y - t)));
	} 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 (z <= (-2.75d-97)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else if (z <= 4.1d-144) then
        tmp = 1.0d0 - (x / (y * (y - t)))
    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 (z <= -2.75e-97) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (z <= 4.1e-144) {
		tmp = 1.0 - (x / (y * (y - t)));
	} 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 z <= -2.75e-97:
		tmp = 1.0 + ((x / z) / (y - t))
	elif z <= 4.1e-144:
		tmp = 1.0 - (x / (y * (y - t)))
	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 (z <= -2.75e-97)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	elseif (z <= 4.1e-144)
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t))));
	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 (z <= -2.75e-97)
		tmp = 1.0 + ((x / z) / (y - t));
	elseif (z <= 4.1e-144)
		tmp = 1.0 - (x / (y * (y - t)));
	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[z, -2.75e-97], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e-144], N[(1.0 - N[(x / N[(y * N[(y - t), $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}\;z \leq -2.75 \cdot 10^{-97}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.74999999999999974e-97

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.74999999999999974e-97 < z < 4.1e-144

    1. Initial program 96.4%

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

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

    if 4.1e-144 < 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. neg-mul-199.9%

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

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

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

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

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

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

        \[\leadsto 1 + \frac{\color{blue}{\frac{1 \cdot x}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      9. *-lft-identity100.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. sub-neg100.0%

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-\left(-z\right)\right) + \left(-y\right)}}}{y - t} \]
      14. remove-double-neg100.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 t around inf 86.3%

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

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

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

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

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

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

Alternative 6: 83.2% 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.1 \cdot 10^{-71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-105}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;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
 (if (<= y -3.1e-71) 1.0 (if (<= y 7.6e-105) (- 1.0 (/ x (* z t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.1e-71) {
		tmp = 1.0;
	} else if (y <= 7.6e-105) {
		tmp = 1.0 - (x / (z * t));
	} else {
		tmp = 1.0;
	}
	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.1d-71)) then
        tmp = 1.0d0
    else if (y <= 7.6d-105) then
        tmp = 1.0d0 - (x / (z * t))
    else
        tmp = 1.0d0
    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.1e-71) {
		tmp = 1.0;
	} else if (y <= 7.6e-105) {
		tmp = 1.0 - (x / (z * t));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -3.1e-71:
		tmp = 1.0
	elif y <= 7.6e-105:
		tmp = 1.0 - (x / (z * t))
	else:
		tmp = 1.0
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -3.1e-71)
		tmp = 1.0;
	elseif (y <= 7.6e-105)
		tmp = Float64(1.0 - Float64(x / Float64(z * t)));
	else
		tmp = 1.0;
	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.1e-71)
		tmp = 1.0;
	elseif (y <= 7.6e-105)
		tmp = 1.0 - (x / (z * t));
	else
		tmp = 1.0;
	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, -3.1e-71], 1.0, If[LessEqual[y, 7.6e-105], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-71}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 7.6 \cdot 10^{-105}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.10000000000000002e-71 or 7.5999999999999995e-105 < y

    1. Initial program 99.9%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
    4. Taylor expanded in x around 0 88.0%

      \[\leadsto \color{blue}{1} \]

    if -3.10000000000000002e-71 < y < 7.5999999999999995e-105

    1. Initial program 95.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{-71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-105}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 82.7% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-105}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;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
 (if (<= y -1.9e-71) 1.0 (if (<= y 9e-105) (- 1.0 (/ (/ x t) z)) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.9e-71) {
		tmp = 1.0;
	} else if (y <= 9e-105) {
		tmp = 1.0 - ((x / t) / z);
	} else {
		tmp = 1.0;
	}
	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 <= (-1.9d-71)) then
        tmp = 1.0d0
    else if (y <= 9d-105) then
        tmp = 1.0d0 - ((x / t) / z)
    else
        tmp = 1.0d0
    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 <= -1.9e-71) {
		tmp = 1.0;
	} else if (y <= 9e-105) {
		tmp = 1.0 - ((x / t) / z);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -1.9e-71:
		tmp = 1.0
	elif y <= 9e-105:
		tmp = 1.0 - ((x / t) / z)
	else:
		tmp = 1.0
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.9e-71)
		tmp = 1.0;
	elseif (y <= 9e-105)
		tmp = Float64(1.0 - Float64(Float64(x / t) / z));
	else
		tmp = 1.0;
	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 <= -1.9e-71)
		tmp = 1.0;
	elseif (y <= 9e-105)
		tmp = 1.0 - ((x / t) / z);
	else
		tmp = 1.0;
	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, -1.9e-71], 1.0, If[LessEqual[y, 9e-105], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-71}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 9 \cdot 10^{-105}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.89999999999999996e-71 or 8.9999999999999995e-105 < y

    1. Initial program 99.9%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
    4. Taylor expanded in x around 0 88.0%

      \[\leadsto \color{blue}{1} \]

    if -1.89999999999999996e-71 < y < 8.9999999999999995e-105

    1. Initial program 95.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num95.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-\frac{x}{y - t}}{z}} \]
      5. distribute-neg-frac82.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-105}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 82.7% 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.2 \cdot 10^{-71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-105}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;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
 (if (<= y -6.2e-71) 1.0 (if (<= y 9e-105) (- 1.0 (/ (/ x z) t)) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -6.2e-71) {
		tmp = 1.0;
	} else if (y <= 9e-105) {
		tmp = 1.0 - ((x / z) / t);
	} else {
		tmp = 1.0;
	}
	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.2d-71)) then
        tmp = 1.0d0
    else if (y <= 9d-105) then
        tmp = 1.0d0 - ((x / z) / t)
    else
        tmp = 1.0d0
    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.2e-71) {
		tmp = 1.0;
	} else if (y <= 9e-105) {
		tmp = 1.0 - ((x / z) / t);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -6.2e-71:
		tmp = 1.0
	elif y <= 9e-105:
		tmp = 1.0 - ((x / z) / t)
	else:
		tmp = 1.0
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -6.2e-71)
		tmp = 1.0;
	elseif (y <= 9e-105)
		tmp = Float64(1.0 - Float64(Float64(x / z) / t));
	else
		tmp = 1.0;
	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.2e-71)
		tmp = 1.0;
	elseif (y <= 9e-105)
		tmp = 1.0 - ((x / z) / t);
	else
		tmp = 1.0;
	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.2e-71], 1.0, If[LessEqual[y, 9e-105], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-71}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 9 \cdot 10^{-105}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.20000000000000004e-71 or 8.9999999999999995e-105 < y

    1. Initial program 99.9%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
    4. Taylor expanded in x around 0 88.0%

      \[\leadsto \color{blue}{1} \]

    if -6.20000000000000004e-71 < y < 8.9999999999999995e-105

    1. Initial program 95.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num95.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{-71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-105}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 88.7% accurate, 0.8× 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^{-115}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{\left(z - y\right) \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 1.25e-115) (+ 1.0 (/ (/ x z) (- 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 (t <= 1.25e-115) {
		tmp = 1.0 + ((x / z) / (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 (t <= 1.25d-115) then
        tmp = 1.0d0 + ((x / z) / (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 (t <= 1.25e-115) {
		tmp = 1.0 + ((x / z) / (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 t <= 1.25e-115:
		tmp = 1.0 + ((x / z) / (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 (t <= 1.25e-115)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	else
		tmp = Float64(1.0 - Float64(x / Float64(Float64(z - 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 <= 1.25e-115)
		tmp = 1.0 + ((x / z) / (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[LessEqual[t, 1.25e-115], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(N[(z - y), $MachinePrecision] * t), $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^{-115}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

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


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

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \frac{\color{blue}{\frac{1 \cdot x}{-1 \cdot \left(y - z\right)}}}{y - t} \]
      9. *-lft-identity98.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. sub-neg98.9%

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-\left(-z\right)\right) + \left(-y\right)}}}{y - t} \]
      14. remove-double-neg98.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 77.6%

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

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

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

    if 1.2500000000000001e-115 < t

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{\frac{x}{t}}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}} \]
      9. add-sqr-sqrt49.4%

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

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

        \[\leadsto 1 - \frac{\frac{x}{t}}{\left(-y\right) + \left(-\sqrt{\color{blue}{z \cdot z}}\right)} \]
      12. sqrt-unprod37.4%

        \[\leadsto 1 - \frac{\frac{x}{t}}{\left(-y\right) + \left(-\color{blue}{\sqrt{z} \cdot \sqrt{z}}\right)} \]
      13. add-sqr-sqrt79.8%

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

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

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

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

        \[\leadsto 1 - \frac{\frac{x}{t}}{\left(-y\right) + \color{blue}{\sqrt{z} \cdot \sqrt{z}}} \]
      18. add-sqr-sqrt91.4%

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

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

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

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

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

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

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

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

Alternative 10: 74.5% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.06 \cdot 10^{-159}:\\ \;\;\;\;1\\ \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 (<= z -1.06e-159) 1.0 (+ 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 (z <= -1.06e-159) {
		tmp = 1.0;
	} 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 (z <= (-1.06d-159)) then
        tmp = 1.0d0
    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 (z <= -1.06e-159) {
		tmp = 1.0;
	} 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 z <= -1.06e-159:
		tmp = 1.0
	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 (z <= -1.06e-159)
		tmp = 1.0;
	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 (z <= -1.06e-159)
		tmp = 1.0;
	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[z, -1.06e-159], 1.0, 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}\;z \leq -1.06 \cdot 10^{-159}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.06e-159

    1. Initial program 99.0%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
    4. Taylor expanded in x around 0 79.6%

      \[\leadsto \color{blue}{1} \]

    if -1.06e-159 < z

    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. neg-mul-198.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 + \color{blue}{-1 \cdot \frac{x}{y \cdot \left(y - t\right)}} \]
    6. Step-by-step derivation
      1. mul-1-neg77.9%

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

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

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

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

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

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

Alternative 11: 74.6% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{-159}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{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 -1.5e-159) 1.0 (+ 1.0 (/ (/ x t) y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.5e-159) {
		tmp = 1.0;
	} else {
		tmp = 1.0 + ((x / t) / 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 <= (-1.5d-159)) then
        tmp = 1.0d0
    else
        tmp = 1.0d0 + ((x / t) / 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 <= -1.5e-159) {
		tmp = 1.0;
	} else {
		tmp = 1.0 + ((x / t) / y);
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if z <= -1.5e-159:
		tmp = 1.0
	else:
		tmp = 1.0 + ((x / t) / y)
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -1.5e-159)
		tmp = 1.0;
	else
		tmp = Float64(1.0 + Float64(Float64(x / t) / 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 <= -1.5e-159)
		tmp = 1.0;
	else
		tmp = 1.0 + ((x / t) / 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, -1.5e-159], 1.0, N[(1.0 + N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-159}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.50000000000000005e-159

    1. Initial program 99.0%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
    4. Taylor expanded in x around 0 79.6%

      \[\leadsto \color{blue}{1} \]

    if -1.50000000000000005e-159 < z

    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. neg-mul-198.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 + \color{blue}{-1 \cdot \frac{x}{y \cdot \left(y - t\right)}} \]
    6. Step-by-step derivation
      1. mul-1-neg77.9%

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{t}}{y}} \]
    10. Simplified61.0%

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

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

Alternative 12: 74.3% accurate, 11.0× speedup?

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

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

    \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - z\right)}} \]
  4. Taylor expanded in x around 0 74.0%

    \[\leadsto \color{blue}{1} \]
  5. Final simplification74.0%

    \[\leadsto 1 \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024029 
(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)))))