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

Percentage Accurate: 98.9% → 98.6%
Time: 16.7s
Alternatives: 10
Speedup: 1.0×

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 10 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: 98.9% 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.6% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 2: 90.1% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -8.8e15

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Taylor expanded in z around inf 98.4%

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

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

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

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

    if -8.8e15 < z < -1.7999999999999999e-168

    1. Initial program 99.9%

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

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

    if -1.7999999999999999e-168 < z < 1.20000000000000008e-244

    1. Initial program 90.8%

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

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

    if 1.20000000000000008e-244 < z

    1. Initial program 99.2%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Taylor expanded in t around inf 86.6%

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

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

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

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

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

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

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

        \[\leadsto 1 - 1 \cdot \frac{x}{\color{blue}{-t \cdot \left(y - z\right)}} \]
      5. distribute-rgt-neg-in86.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.8 \cdot 10^{+15}:\\ \;\;\;\;1 - \frac{x}{z \cdot \left(t - y\right)}\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-168}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-244}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \end{array} \]

Alternative 3: 85.5% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.2000000000000003e-129 or 4.4999999999999997e-104 < y

    1. Initial program 100.0%

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

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

    if -3.2000000000000003e-129 < y < 4.4999999999999997e-104

    1. Initial program 94.1%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Taylor expanded in t around inf 83.2%

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

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

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

      \[\leadsto 1 - \frac{x}{\color{blue}{\left(-t\right) \cdot \left(y - z\right)}} \]
    5. Step-by-step derivation
      1. clear-num83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-129} \lor \neg \left(y \leq 4.5 \cdot 10^{-104}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \end{array} \]

Alternative 4: 90.3% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.19999999999999982e-127 or 9.0000000000000003e-27 < t

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Taylor expanded in t around inf 95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.19999999999999982e-127 < t < 9.0000000000000003e-27

    1. Initial program 95.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.2 \cdot 10^{-127} \lor \neg \left(t \leq 9 \cdot 10^{-27}\right):\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \end{array} \]

Alternative 5: 88.1% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.00000000000000003e-43 or 9.99999999999999939e-99 < y

    1. Initial program 100.0%

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

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

    if -3.00000000000000003e-43 < y < 9.99999999999999939e-99

    1. Initial program 95.1%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. associate-/r*96.0%

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

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

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

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

      \[\leadsto 1 - \frac{\color{blue}{-\frac{x}{z}}}{y - t} \]
    7. Step-by-step derivation
      1. distribute-frac-neg89.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \left(0 + \frac{x}{\left(0 - \color{blue}{\left(\left(-t\right) + y\right)}\right) \cdot z}\right) \]
      17. associate--r+89.2%

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t - y}}{z}} \]
    10. Simplified87.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{-43} \lor \neg \left(y \leq 10^{-98}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{t - y}}{z}\\ \end{array} \]

Alternative 6: 89.2% accurate, 0.8× speedup?

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

    1. Initial program 100.0%

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

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

    if -2.95000000000000018e-44 < y < 7.7999999999999997e-97

    1. Initial program 95.1%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. associate-/r*96.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.95 \cdot 10^{-44} \lor \neg \left(y \leq 7.8 \cdot 10^{-97}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \end{array} \]

Alternative 7: 81.4% accurate, 1.0× speedup?

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto 1 - {\color{blue}{\left(\left(\left(y - z\right) \cdot \left(y - t\right)\right) \cdot \frac{1}{x}\right)}}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{\left(y - z\right) \cdot \left(y - t\right)}{x}\right)}^{\left(\frac{-1}{2}\right)} \]
      6. associate-*l*79.8%

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

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

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

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{\color{blue}{-0.5}} \cdot {\left(\frac{\left(y - z\right) \cdot \left(y - t\right)}{x}\right)}^{\left(\frac{-1}{2}\right)} \]
      10. div-inv79.8%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\color{blue}{\left(\left(\left(y - z\right) \cdot \left(y - t\right)\right) \cdot \frac{1}{x}\right)}}^{\left(\frac{-1}{2}\right)} \]
      11. associate-*l*79.8%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\color{blue}{\left(\left(y - z\right) \cdot \left(\left(y - t\right) \cdot \frac{1}{x}\right)\right)}}^{\left(\frac{-1}{2}\right)} \]
      12. div-inv79.8%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \color{blue}{\frac{y - t}{x}}\right)}^{\left(\frac{-1}{2}\right)} \]
      13. metadata-eval79.8%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{\left(\frac{\color{blue}{-1}}{2}\right)} \]
      14. metadata-eval79.8%

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

      \[\leadsto 1 - \color{blue}{{\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. pow-sqr100.0%

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{{y}^{2}}} \]
    7. Step-by-step derivation
      1. unpow294.4%

        \[\leadsto 1 - \frac{x}{\color{blue}{y \cdot y}} \]
    8. Simplified94.4%

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

    if -1.90000000000000006e-9 < y < 90

    1. Initial program 96.2%

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

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

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

Alternative 8: 81.4% accurate, 1.0× speedup?

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

\mathbf{elif}\;y \leq 23500:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto 1 - {\color{blue}{\left(\left(\left(y - z\right) \cdot \left(y - t\right)\right) \cdot \frac{1}{x}\right)}}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{\left(y - z\right) \cdot \left(y - t\right)}{x}\right)}^{\left(\frac{-1}{2}\right)} \]
      6. associate-*l*76.5%

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

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

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

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{\color{blue}{-0.5}} \cdot {\left(\frac{\left(y - z\right) \cdot \left(y - t\right)}{x}\right)}^{\left(\frac{-1}{2}\right)} \]
      10. div-inv76.5%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\color{blue}{\left(\left(\left(y - z\right) \cdot \left(y - t\right)\right) \cdot \frac{1}{x}\right)}}^{\left(\frac{-1}{2}\right)} \]
      11. associate-*l*76.5%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\color{blue}{\left(\left(y - z\right) \cdot \left(\left(y - t\right) \cdot \frac{1}{x}\right)\right)}}^{\left(\frac{-1}{2}\right)} \]
      12. div-inv76.5%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \color{blue}{\frac{y - t}{x}}\right)}^{\left(\frac{-1}{2}\right)} \]
      13. metadata-eval76.5%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{\left(\frac{\color{blue}{-1}}{2}\right)} \]
      14. metadata-eval76.5%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{\color{blue}{-0.5}} \]
    3. Applied egg-rr76.5%

      \[\leadsto 1 - \color{blue}{{\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. pow-sqr100.0%

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

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

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

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

      \[\leadsto 1 - \frac{1}{\color{blue}{\frac{{y}^{2}}{x}}} \]
    7. Step-by-step derivation
      1. unpow293.8%

        \[\leadsto 1 - \frac{1}{\frac{\color{blue}{y \cdot y}}{x}} \]
    8. Simplified93.8%

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

    if -3.3999999999999998e-9 < y < 23500

    1. Initial program 96.2%

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

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

    if 23500 < y

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto 1 - {\color{blue}{\left(\left(\left(y - z\right) \cdot \left(y - t\right)\right) \cdot \frac{1}{x}\right)}}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{\left(y - z\right) \cdot \left(y - t\right)}{x}\right)}^{\left(\frac{-1}{2}\right)} \]
      6. associate-*l*83.6%

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

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

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

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

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\color{blue}{\left(\left(\left(y - z\right) \cdot \left(y - t\right)\right) \cdot \frac{1}{x}\right)}}^{\left(\frac{-1}{2}\right)} \]
      11. associate-*l*83.6%

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

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \color{blue}{\frac{y - t}{x}}\right)}^{\left(\frac{-1}{2}\right)} \]
      13. metadata-eval83.6%

        \[\leadsto 1 - {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{\left(\frac{\color{blue}{-1}}{2}\right)} \]
      14. metadata-eval83.6%

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

      \[\leadsto 1 - \color{blue}{{\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5} \cdot {\left(\left(y - z\right) \cdot \frac{y - t}{x}\right)}^{-0.5}} \]
    4. Step-by-step derivation
      1. pow-sqr100.0%

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{{y}^{2}}} \]
    7. Step-by-step derivation
      1. unpow295.2%

        \[\leadsto 1 - \frac{x}{\color{blue}{y \cdot y}} \]
    8. Simplified95.2%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.5%

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

Alternative 9: 98.9% accurate, 1.0× speedup?

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

    \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
  2. Final simplification98.1%

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

Alternative 10: 60.8% accurate, 1.6× speedup?

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

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

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

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

Reproduce

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