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

Percentage Accurate: 99.3% → 98.4%
Time: 8.4s
Alternatives: 14
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 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.4% accurate, 1.0× speedup?

\[\begin{array}{l} [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.5%

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

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

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

    \[\leadsto 1 - \color{blue}{\frac{x}{y - z} \cdot \frac{1}{y - t}} \]
  4. Step-by-step derivation
    1. un-div-inv98.8%

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

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

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

Alternative 2: 82.0% accurate, 0.7× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-83}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.42 \cdot 10^{-102}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+40}:\\ \;\;\;\;1 + \frac{x}{y \cdot z}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+47}:\\ \;\;\;\;1 + \frac{x}{y \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 -4.5e-83)
   1.0
   (if (<= y 1.42e-102)
     (- 1.0 (/ (/ x z) t))
     (if (<= y 1.45e+40)
       (+ 1.0 (/ x (* y z)))
       (if (<= y 1.35e+47) (+ 1.0 (/ x (* y t))) (- 1.0 (/ x (* y y))))))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -4.5e-83) {
		tmp = 1.0;
	} else if (y <= 1.42e-102) {
		tmp = 1.0 - ((x / z) / t);
	} else if (y <= 1.45e+40) {
		tmp = 1.0 + (x / (y * z));
	} else if (y <= 1.35e+47) {
		tmp = 1.0 + (x / (y * 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 <= (-4.5d-83)) then
        tmp = 1.0d0
    else if (y <= 1.42d-102) then
        tmp = 1.0d0 - ((x / z) / t)
    else if (y <= 1.45d+40) then
        tmp = 1.0d0 + (x / (y * z))
    else if (y <= 1.35d+47) then
        tmp = 1.0d0 + (x / (y * 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 <= -4.5e-83) {
		tmp = 1.0;
	} else if (y <= 1.42e-102) {
		tmp = 1.0 - ((x / z) / t);
	} else if (y <= 1.45e+40) {
		tmp = 1.0 + (x / (y * z));
	} else if (y <= 1.35e+47) {
		tmp = 1.0 + (x / (y * 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 <= -4.5e-83:
		tmp = 1.0
	elif y <= 1.42e-102:
		tmp = 1.0 - ((x / z) / t)
	elif y <= 1.45e+40:
		tmp = 1.0 + (x / (y * z))
	elif y <= 1.35e+47:
		tmp = 1.0 + (x / (y * 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 <= -4.5e-83)
		tmp = 1.0;
	elseif (y <= 1.42e-102)
		tmp = Float64(1.0 - Float64(Float64(x / z) / t));
	elseif (y <= 1.45e+40)
		tmp = Float64(1.0 + Float64(x / Float64(y * z)));
	elseif (y <= 1.35e+47)
		tmp = Float64(1.0 + Float64(x / Float64(y * 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 <= -4.5e-83)
		tmp = 1.0;
	elseif (y <= 1.42e-102)
		tmp = 1.0 - ((x / z) / t);
	elseif (y <= 1.45e+40)
		tmp = 1.0 + (x / (y * z));
	elseif (y <= 1.35e+47)
		tmp = 1.0 + (x / (y * 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, -4.5e-83], 1.0, If[LessEqual[y, 1.42e-102], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+40], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+47], N[(1.0 + N[(x / N[(y * 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 -4.5 \cdot 10^{-83}:\\
\;\;\;\;1\\

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

\mathbf{elif}\;y \leq 1.45 \cdot 10^{+40}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\

\mathbf{elif}\;y \leq 1.35 \cdot 10^{+47}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -4.49999999999999997e-83

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u68.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    11. Simplified69.1%

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

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

    if -4.49999999999999997e-83 < y < 1.42000000000000009e-102

    1. Initial program 95.5%

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. *-commutative78.0%

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

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

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

    if 1.42000000000000009e-102 < y < 1.45000000000000009e40

    1. Initial program 99.8%

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

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

      \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{y \cdot z}} \]
    4. Step-by-step derivation
      1. mul-1-neg36.7%

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

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

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

    if 1.45000000000000009e40 < y < 1.34999999999999998e47

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u33.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    12. Step-by-step derivation
      1. sub-neg34.2%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{y \cdot t}} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto 1 + \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{y \cdot t} \]
      4. sqrt-unprod60.9%

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

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

        \[\leadsto 1 + \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot t} \]
      7. add-sqr-sqrt61.7%

        \[\leadsto 1 + \frac{\color{blue}{x}}{y \cdot t} \]
    13. Applied egg-rr61.7%

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

    if 1.34999999999999998e47 < 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 97.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-83}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.42 \cdot 10^{-102}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+40}:\\ \;\;\;\;1 + \frac{x}{y \cdot z}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+47}:\\ \;\;\;\;1 + \frac{x}{y \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y \cdot y}\\ \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 -1.7 \cdot 10^{-159} \lor \neg \left(y \leq 8.8 \cdot 10^{-105}\right):\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\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 -1.7e-159) (not (<= y 8.8e-105)))
   (- 1.0 (/ x (* y (- y z))))
   (- 1.0 (/ (/ x z) t))))
assert(z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -1.7e-159) || !(y <= 8.8e-105)) {
		tmp = 1.0 - (x / (y * (y - z)));
	} 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.7d-159)) .or. (.not. (y <= 8.8d-105))) then
        tmp = 1.0d0 - (x / (y * (y - z)))
    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.7e-159) || !(y <= 8.8e-105)) {
		tmp = 1.0 - (x / (y * (y - z)));
	} 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.7e-159) or not (y <= 8.8e-105):
		tmp = 1.0 - (x / (y * (y - z)))
	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.7e-159) || !(y <= 8.8e-105))
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z))));
	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 <= -1.7e-159) || ~((y <= 8.8e-105)))
		tmp = 1.0 - (x / (y * (y - z)));
	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.7e-159], N[Not[LessEqual[y, 8.8e-105]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - z), $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 -1.7 \cdot 10^{-159} \lor \neg \left(y \leq 8.8 \cdot 10^{-105}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.69999999999999992e-159 or 8.80000000000000016e-105 < y

    1. Initial program 99.9%

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

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

    if -1.69999999999999992e-159 < y < 8.80000000000000016e-105

    1. Initial program 94.6%

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. *-commutative79.3%

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

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

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

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

Alternative 4: 83.1% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 99.8%

      \[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 -9.8000000000000003e-64 < z < 2.7e-41

    1. Initial program 96.4%

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

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

    if 2.7e-41 < z

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.8 \cdot 10^{-64}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-41}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \end{array} \]

Alternative 5: 82.6% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 99.8%

      \[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 -1.1e-63 < z < 2.45e-42

    1. Initial program 96.4%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{\left(y - t\right) \cdot y}} \]
    3. Step-by-step derivation
      1. associate-/l/89.0%

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

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

    if 2.45e-42 < z

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{-63}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{elif}\;z \leq 2.45 \cdot 10^{-42}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \end{array} \]

Alternative 6: 93.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 98.9%

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

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

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

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

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

    if -1.9e-188 < t < 3.9e-95

    1. Initial program 96.2%

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y - z} \cdot \frac{1}{y - t}} \]
    4. Step-by-step derivation
      1. un-div-inv99.8%

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

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

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

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

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

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

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

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

    if 3.9e-95 < t

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 7: 93.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 98.9%

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y - z}}{y - t}} \]
      2. div-inv97.9%

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

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

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

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

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

        \[\leadsto 1 - \frac{\color{blue}{-\frac{x}{z}}}{y - t} \]
      2. distribute-frac-neg80.5%

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

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

    if -1.9e-188 < t < 2.4999999999999999e-95

    1. Initial program 96.2%

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y - z} \cdot \frac{1}{y - t}} \]
    4. Step-by-step derivation
      1. un-div-inv99.8%

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

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

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

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

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

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

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

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

    if 2.4999999999999999e-95 < t

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 8: 76.7% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.7999999999999996e-258 or 1.29999999999999998e-53 < z

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u49.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.7999999999999996e-258 < z < 1.29999999999999998e-53

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u55.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    12. Step-by-step derivation
      1. sub-neg53.8%

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

        \[\leadsto 1 + \color{blue}{\frac{-x}{y \cdot t}} \]
      3. add-sqr-sqrt25.9%

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

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

        \[\leadsto 1 + \frac{\sqrt{\color{blue}{x \cdot x}}}{y \cdot t} \]
      6. sqrt-unprod27.6%

        \[\leadsto 1 + \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot t} \]
      7. add-sqr-sqrt67.4%

        \[\leadsto 1 + \frac{\color{blue}{x}}{y \cdot t} \]
    13. Applied egg-rr67.4%

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

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

Alternative 9: 83.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u64.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.89999999999999973e-82 < y < 9e18

    1. Initial program 96.6%

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

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

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

Alternative 10: 82.4% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{-83}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{+47}:\\ \;\;\;\;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 -7.5e-83)
   1.0
   (if (<= y 1.26e+47) (- 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 <= -7.5e-83) {
		tmp = 1.0;
	} else if (y <= 1.26e+47) {
		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 <= (-7.5d-83)) then
        tmp = 1.0d0
    else if (y <= 1.26d+47) 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 <= -7.5e-83) {
		tmp = 1.0;
	} else if (y <= 1.26e+47) {
		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 <= -7.5e-83:
		tmp = 1.0
	elif y <= 1.26e+47:
		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 <= -7.5e-83)
		tmp = 1.0;
	elseif (y <= 1.26e+47)
		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 <= -7.5e-83)
		tmp = 1.0;
	elseif (y <= 1.26e+47)
		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, -7.5e-83], 1.0, If[LessEqual[y, 1.26e+47], 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 -7.5 \cdot 10^{-83}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 1.26 \cdot 10^{+47}:\\
\;\;\;\;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 < -7.4999999999999997e-83

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u68.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    11. Simplified69.1%

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

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

    if -7.4999999999999997e-83 < y < 1.26e47

    1. Initial program 96.9%

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

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

    if 1.26e47 < 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 97.3%

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

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

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

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

Alternative 11: 81.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u68.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    11. Simplified69.1%

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

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

    if -1.39999999999999995e-80 < y < 9.0000000000000002e-97

    1. Initial program 95.6%

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
    5. Step-by-step derivation
      1. *-commutative77.4%

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

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

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

    if 9.0000000000000002e-97 < 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 75.3%

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

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

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

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

Alternative 12: 90.6% accurate, 1.0× speedup?

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

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


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

    1. Initial program 97.8%

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y - z} \cdot \frac{1}{y - t}} \]
    4. Step-by-step derivation
      1. un-div-inv98.7%

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{1 \cdot \frac{x}{y - z}}{y}} \]
      4. *-lft-identity79.9%

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

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

    if 3e-95 < t

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 13: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t] = \mathsf{sort}([z, t])\\ \\ 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\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 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(x / Float64(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[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Derivation
  1. Initial program 98.5%

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

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

Alternative 14: 75.3% accurate, 11.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto 1 - \color{blue}{\frac{-x}{y \cdot t}} \]
  8. Step-by-step derivation
    1. expm1-log1p-u50.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  13. Final simplification72.0%

    \[\leadsto 1 \]

Reproduce

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