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

Percentage Accurate: 99.2% → 98.5%
Time: 7.0s
Alternatives: 10
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 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: 99.2% 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.5% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ 1 + \frac{\frac{x}{z - y}}{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 (- z y)) (- y t))))
assert(z < t);
double code(double x, double y, double z, double t) {
	return 1.0 + ((x / (z - y)) / (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 / (z - y)) / (y - t))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 + ((x / (z - y)) / (y - t));
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	return 1.0 + ((x / (z - y)) / (y - t))
z, t = sort([z, t])
function code(x, y, z, t)
	return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t)))
end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 + ((x / (z - y)) / (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[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([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. distribute-frac-neg98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 71.3% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq 7.6 \cdot 10^{+56} \lor \neg \left(y \leq 2.4 \cdot 10^{+192}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.2e31 or 7.59999999999999991e56 < y < 2.3999999999999998e192

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{-x}{y}}{t}} \]
      2. expm1-log1p-u65.5%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{y}}{t}\right)\right)} \]
      3. expm1-udef65.5%

        \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{-x}{y}}{t}\right)} - 1\right)} \]
      4. associate-/l/65.5%

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

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

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

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

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

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

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{x}{t}}{y}}\right)} - 1\right) \]
    7. Applied egg-rr65.8%

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

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

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

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

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

    if -5.2e31 < y < 2.5500000000000001e-17

    1. Initial program 97.2%

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

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

    if 2.5500000000000001e-17 < y < 7.59999999999999991e56 or 2.3999999999999998e192 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+31}:\\ \;\;\;\;1 - \frac{x}{y \cdot t}\\ \mathbf{elif}\;y \leq 2.55 \cdot 10^{-17}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{+56} \lor \neg \left(y \leq 2.4 \cdot 10^{+192}\right):\\ \;\;\;\;1 + \frac{x}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y \cdot t}\\ \end{array} \]

Alternative 3: 86.7% accurate, 0.8× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -370000000 \lor \neg \left(y \leq 2.75 \cdot 10^{-17}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot y}\\ \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 -370000000.0) (not (<= y 2.75e-17)))
   (- 1.0 (/ x (* y y)))
   (+ 1.0 (/ (/ x z) (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -370000000.0) || !(y <= 2.75e-17)) {
		tmp = 1.0 - (x / (y * y));
	} 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 <= (-370000000.0d0)) .or. (.not. (y <= 2.75d-17))) then
        tmp = 1.0d0 - (x / (y * y))
    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 <= -370000000.0) || !(y <= 2.75e-17)) {
		tmp = 1.0 - (x / (y * y));
	} 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 <= -370000000.0) or not (y <= 2.75e-17):
		tmp = 1.0 - (x / (y * y))
	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 <= -370000000.0) || !(y <= 2.75e-17))
		tmp = Float64(1.0 - Float64(x / Float64(y * y)));
	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 <= -370000000.0) || ~((y <= 2.75e-17)))
		tmp = 1.0 - (x / (y * y));
	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, -370000000.0], N[Not[LessEqual[y, 2.75e-17]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $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 -370000000 \lor \neg \left(y \leq 2.75 \cdot 10^{-17}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.7e8 or 2.75e-17 < y

    1. Initial program 99.9%

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

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

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

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

    if -3.7e8 < y < 2.75e-17

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 88.6% accurate, 0.8× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.18 \cdot 10^{-145} \lor \neg \left(y \leq 1.6 \cdot 10^{-17}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\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 -1.18e-145) (not (<= y 1.6e-17)))
   (- 1.0 (/ x (* y (- y z))))
   (+ 1.0 (/ (/ x z) (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -1.18e-145) || !(y <= 1.6e-17)) {
		tmp = 1.0 - (x / (y * (y - z)));
	} 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 <= (-1.18d-145)) .or. (.not. (y <= 1.6d-17))) then
        tmp = 1.0d0 - (x / (y * (y - z)))
    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 <= -1.18e-145) || !(y <= 1.6e-17)) {
		tmp = 1.0 - (x / (y * (y - z)));
	} 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 <= -1.18e-145) or not (y <= 1.6e-17):
		tmp = 1.0 - (x / (y * (y - z)))
	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 <= -1.18e-145) || !(y <= 1.6e-17))
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z))));
	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 <= -1.18e-145) || ~((y <= 1.6e-17)))
		tmp = 1.0 - (x / (y * (y - z)));
	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, -1.18e-145], N[Not[LessEqual[y, 1.6e-17]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - z), $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 -1.18 \cdot 10^{-145} \lor \neg \left(y \leq 1.6 \cdot 10^{-17}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.18000000000000006e-145 or 1.6000000000000001e-17 < y

    1. Initial program 100.0%

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

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

    if -1.18000000000000006e-145 < y < 1.6000000000000001e-17

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 91.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;z \leq 1.45 \cdot 10^{-61}:\\
\;\;\;\;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 3 regimes
  2. if z < -2.59999999999999984e-108

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.59999999999999984e-108 < z < 1.45e-61

    1. Initial program 96.2%

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

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

    if 1.45e-61 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{-108}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-61}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \end{array} \]

Alternative 6: 81.8% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{-44} \lor \neg \left(y \leq 1.15 \cdot 10^{-48}\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 -9e-44) (not (<= y 1.15e-48)))
   (- 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 <= -9e-44) || !(y <= 1.15e-48)) {
		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 <= (-9d-44)) .or. (.not. (y <= 1.15d-48))) 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 <= -9e-44) || !(y <= 1.15e-48)) {
		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 <= -9e-44) or not (y <= 1.15e-48):
		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 <= -9e-44) || !(y <= 1.15e-48))
		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 <= -9e-44) || ~((y <= 1.15e-48)))
		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, -9e-44], N[Not[LessEqual[y, 1.15e-48]], $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 -9 \cdot 10^{-44} \lor \neg \left(y \leq 1.15 \cdot 10^{-48}\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 < -8.9999999999999997e-44 or 1.15e-48 < y

    1. Initial program 100.0%

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

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

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

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

    if -8.9999999999999997e-44 < y < 1.15e-48

    1. Initial program 96.7%

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

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

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

Alternative 7: 81.3% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.95 \cdot 10^{-43} \lor \neg \left(y \leq 6 \cdot 10^{-49}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{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 -1.95e-43) (not (<= y 6e-49)))
   (- 1.0 (/ x (* y y)))
   (- 1.0 (/ (/ x t) z))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -1.95e-43) || !(y <= 6e-49)) {
		tmp = 1.0 - (x / (y * y));
	} else {
		tmp = 1.0 - ((x / t) / 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 <= (-1.95d-43)) .or. (.not. (y <= 6d-49))) then
        tmp = 1.0d0 - (x / (y * y))
    else
        tmp = 1.0d0 - ((x / t) / 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 <= -1.95e-43) || !(y <= 6e-49)) {
		tmp = 1.0 - (x / (y * y));
	} else {
		tmp = 1.0 - ((x / t) / z);
	}
	return tmp;
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	tmp = 0
	if (y <= -1.95e-43) or not (y <= 6e-49):
		tmp = 1.0 - (x / (y * y))
	else:
		tmp = 1.0 - ((x / t) / z)
	return tmp
z, t = sort([z, t])
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -1.95e-43) || !(y <= 6e-49))
		tmp = Float64(1.0 - Float64(x / Float64(y * y)));
	else
		tmp = Float64(1.0 - Float64(Float64(x / t) / z));
	end
	return tmp
end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -1.95e-43) || ~((y <= 6e-49)))
		tmp = 1.0 - (x / (y * y));
	else
		tmp = 1.0 - ((x / t) / 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, -1.95e-43], N[Not[LessEqual[y, 6e-49]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-43} \lor \neg \left(y \leq 6 \cdot 10^{-49}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.95e-43 or 6e-49 < y

    1. Initial program 100.0%

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

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

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

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

    if -1.95e-43 < y < 6e-49

    1. Initial program 96.7%

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

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

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

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

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

Alternative 8: 89.1% accurate, 1.0× speedup?

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

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


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

    1. Initial program 98.7%

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

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

    if 4.29999999999999984e-169 < t

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 4.3 \cdot 10^{-169}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\ \end{array} \]

Alternative 9: 66.9% accurate, 1.2× speedup?

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. 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. Taylor expanded in z around inf 91.0%

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

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

    if -1.7000000000000001e-84 < z

    1. Initial program 97.9%

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{-x}{y}}{t}} \]
      2. expm1-log1p-u47.8%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{y}}{t}\right)\right)} \]
      3. expm1-udef47.7%

        \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{-x}{y}}{t}\right)} - 1\right)} \]
      4. associate-/l/47.7%

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

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

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

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

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

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

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\frac{x}{t}}{y}}\right)} - 1\right) \]
    7. Applied egg-rr43.9%

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

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{x}{t}}{y}\right)\right)} \]
      2. expm1-log1p46.0%

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

        \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot y}} \]
    9. Simplified46.0%

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

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

Alternative 10: 57.2% accurate, 1.6× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ 1 + \frac{x}{z \cdot y} \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 y))))
assert(z < t);
double code(double x, double y, double z, double t) {
	return 1.0 + (x / (z * y));
}
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 * y))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 + (x / (z * y));
}
[z, t] = sort([z, t])
def code(x, y, z, t):
	return 1.0 + (x / (z * y))
z, t = sort([z, t])
function code(x, y, z, t)
	return Float64(1.0 + Float64(x / Float64(z * y)))
end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 + (x / (z * y));
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 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 + \frac{x}{z \cdot y}
\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. distribute-frac-neg98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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