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

Percentage Accurate: 99.2% → 99.2%
Time: 9.7s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 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: 99.2% accurate, 1.0× speedup?

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

\\
1 + \frac{x}{\left(y - t\right) \cdot \left(z - y\right)}
\end{array}
Derivation
  1. Initial program 98.6%

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

    \[\leadsto 1 + \frac{x}{\left(y - t\right) \cdot \left(z - y\right)} \]
  4. Add Preprocessing

Alternative 2: 84.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{-48} \lor \neg \left(y \leq 3400000\right):\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -1.65e-48) (not (<= y 3400000.0)))
   (- 1.0 (/ x (* y (- y t))))
   (- 1.0 (/ (/ x t) z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -1.65e-48) || !(y <= 3400000.0)) {
		tmp = 1.0 - (x / (y * (y - t)));
	} else {
		tmp = 1.0 - ((x / t) / z);
	}
	return tmp;
}
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.65d-48)) .or. (.not. (y <= 3400000.0d0))) then
        tmp = 1.0d0 - (x / (y * (y - t)))
    else
        tmp = 1.0d0 - ((x / t) / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -1.65e-48) || !(y <= 3400000.0)) {
		tmp = 1.0 - (x / (y * (y - t)));
	} else {
		tmp = 1.0 - ((x / t) / z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -1.65e-48) or not (y <= 3400000.0):
		tmp = 1.0 - (x / (y * (y - t)))
	else:
		tmp = 1.0 - ((x / t) / z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -1.65e-48) || !(y <= 3400000.0))
		tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t))));
	else
		tmp = Float64(1.0 - Float64(Float64(x / t) / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -1.65e-48) || ~((y <= 3400000.0)))
		tmp = 1.0 - (x / (y * (y - t)));
	else
		tmp = 1.0 - ((x / t) / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.65e-48], N[Not[LessEqual[y, 3400000.0]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-48} \lor \neg \left(y \leq 3400000\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\

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


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

    1. Initial program 100.0%

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

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

    if -1.65e-48 < y < 3.4e6

    1. Initial program 97.1%

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t} \cdot \frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv74.1%

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

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

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

Alternative 3: 91.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.8 \cdot 10^{-110} \lor \neg \left(t \leq 6.8 \cdot 10^{-144}\right):\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{z - y}}{y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -2.8e-110) (not (<= t 6.8e-144)))
   (- 1.0 (/ x (* t (- z y))))
   (+ 1.0 (/ (/ x (- z y)) y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2.8e-110) || !(t <= 6.8e-144)) {
		tmp = 1.0 - (x / (t * (z - y)));
	} else {
		tmp = 1.0 + ((x / (z - y)) / y);
	}
	return tmp;
}
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 <= (-2.8d-110)) .or. (.not. (t <= 6.8d-144))) then
        tmp = 1.0d0 - (x / (t * (z - y)))
    else
        tmp = 1.0d0 + ((x / (z - y)) / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2.8e-110) || !(t <= 6.8e-144)) {
		tmp = 1.0 - (x / (t * (z - y)));
	} else {
		tmp = 1.0 + ((x / (z - y)) / y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -2.8e-110) or not (t <= 6.8e-144):
		tmp = 1.0 - (x / (t * (z - y)))
	else:
		tmp = 1.0 + ((x / (z - y)) / y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -2.8e-110) || !(t <= 6.8e-144))
		tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y))));
	else
		tmp = Float64(1.0 + Float64(Float64(x / Float64(z - y)) / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -2.8e-110) || ~((t <= 6.8e-144)))
		tmp = 1.0 - (x / (t * (z - y)));
	else
		tmp = 1.0 + ((x / (z - y)) / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.8e-110], N[Not[LessEqual[t, 6.8e-144]], $MachinePrecision]], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-110} \lor \neg \left(t \leq 6.8 \cdot 10^{-144}\right):\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.8e-110 or 6.80000000000000035e-144 < t

    1. Initial program 99.6%

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

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

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

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

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

    if -2.8e-110 < t < 6.80000000000000035e-144

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 87.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.5 \cdot 10^{-206}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-143}:\\ \;\;\;\;1 + \frac{\frac{x}{z - y}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -2.5e-206)
   (+ 1.0 (/ (/ x z) (- y t)))
   (if (<= t 1.3e-143)
     (+ 1.0 (/ (/ x (- z y)) y))
     (- 1.0 (/ x (* t (- z y)))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.5e-206) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 1.3e-143) {
		tmp = 1.0 + ((x / (z - y)) / y);
	} else {
		tmp = 1.0 - (x / (t * (z - y)));
	}
	return tmp;
}
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 <= (-2.5d-206)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else if (t <= 1.3d-143) then
        tmp = 1.0d0 + ((x / (z - y)) / y)
    else
        tmp = 1.0d0 - (x / (t * (z - y)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.5e-206) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 1.3e-143) {
		tmp = 1.0 + ((x / (z - y)) / y);
	} else {
		tmp = 1.0 - (x / (t * (z - y)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -2.5e-206:
		tmp = 1.0 + ((x / z) / (y - t))
	elif t <= 1.3e-143:
		tmp = 1.0 + ((x / (z - y)) / y)
	else:
		tmp = 1.0 - (x / (t * (z - y)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -2.5e-206)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	elseif (t <= 1.3e-143)
		tmp = Float64(1.0 + Float64(Float64(x / Float64(z - y)) / y));
	else
		tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -2.5e-206)
		tmp = 1.0 + ((x / z) / (y - t));
	elseif (t <= 1.3e-143)
		tmp = 1.0 + ((x / (z - y)) / y);
	else
		tmp = 1.0 - (x / (t * (z - y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.5e-206], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e-143], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-206}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

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

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


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

    1. Initial program 97.9%

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

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

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

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

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

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

    if -2.5e-206 < t < 1.29999999999999994e-143

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

    if 1.29999999999999994e-143 < t

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 5: 87.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -3.7 \cdot 10^{-205}:\\ \;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\ \mathbf{elif}\;t \leq 2.55 \cdot 10^{-61}:\\ \;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -3.7e-205)
   (+ 1.0 (/ (/ x z) (- y t)))
   (if (<= t 2.55e-61)
     (+ 1.0 (/ x (* y (- z y))))
     (- 1.0 (/ (/ x t) (- z y))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -3.7e-205) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 2.55e-61) {
		tmp = 1.0 + (x / (y * (z - y)));
	} else {
		tmp = 1.0 - ((x / t) / (z - y));
	}
	return tmp;
}
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 <= (-3.7d-205)) then
        tmp = 1.0d0 + ((x / z) / (y - t))
    else if (t <= 2.55d-61) then
        tmp = 1.0d0 + (x / (y * (z - y)))
    else
        tmp = 1.0d0 - ((x / t) / (z - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -3.7e-205) {
		tmp = 1.0 + ((x / z) / (y - t));
	} else if (t <= 2.55e-61) {
		tmp = 1.0 + (x / (y * (z - y)));
	} else {
		tmp = 1.0 - ((x / t) / (z - y));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -3.7e-205:
		tmp = 1.0 + ((x / z) / (y - t))
	elif t <= 2.55e-61:
		tmp = 1.0 + (x / (y * (z - y)))
	else:
		tmp = 1.0 - ((x / t) / (z - y))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -3.7e-205)
		tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t)));
	elseif (t <= 2.55e-61)
		tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y))));
	else
		tmp = Float64(1.0 - Float64(Float64(x / t) / Float64(z - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -3.7e-205)
		tmp = 1.0 + ((x / z) / (y - t));
	elseif (t <= 2.55e-61)
		tmp = 1.0 + (x / (y * (z - y)));
	else
		tmp = 1.0 - ((x / t) / (z - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.7e-205], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.55e-61], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{-205}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\

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

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


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

    1. Initial program 97.9%

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

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

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

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

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

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

    if -3.7000000000000001e-205 < t < 2.54999999999999984e-61

    1. Initial program 98.3%

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

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

    if 2.54999999999999984e-61 < t

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 77.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{-165}:\\ \;\;\;\;1\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{-104}:\\ \;\;\;\;1 + \frac{x}{y \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -3.3e-165) 1.0 (if (<= z 5.3e-104) (+ 1.0 (/ x (* y t))) 1.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -3.3e-165) {
		tmp = 1.0;
	} else if (z <= 5.3e-104) {
		tmp = 1.0 + (x / (y * t));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
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 <= (-3.3d-165)) then
        tmp = 1.0d0
    else if (z <= 5.3d-104) then
        tmp = 1.0d0 + (x / (y * t))
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -3.3e-165) {
		tmp = 1.0;
	} else if (z <= 5.3e-104) {
		tmp = 1.0 + (x / (y * t));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -3.3e-165:
		tmp = 1.0
	elif z <= 5.3e-104:
		tmp = 1.0 + (x / (y * t))
	else:
		tmp = 1.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -3.3e-165)
		tmp = 1.0;
	elseif (z <= 5.3e-104)
		tmp = Float64(1.0 + Float64(x / Float64(y * t)));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -3.3e-165)
		tmp = 1.0;
	elseif (z <= 5.3e-104)
		tmp = 1.0 + (x / (y * t));
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.3e-165], 1.0, If[LessEqual[z, 5.3e-104], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-165}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.2999999999999998e-165 or 5.30000000000000018e-104 < z

    1. Initial program 99.4%

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

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

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

    if -3.2999999999999998e-165 < z < 5.30000000000000018e-104

    1. Initial program 96.2%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t \cdot y} + 1} \]
      2. *-commutative71.8%

        \[\leadsto \frac{x}{\color{blue}{y \cdot t}} + 1 \]
    6. Simplified71.8%

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

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

Alternative 7: 77.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.1 \cdot 10^{-164}:\\ \;\;\;\;1\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-99}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -5.1e-164) 1.0 (if (<= z 7.5e-99) (+ 1.0 (/ (/ x t) y)) 1.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -5.1e-164) {
		tmp = 1.0;
	} else if (z <= 7.5e-99) {
		tmp = 1.0 + ((x / t) / y);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
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 <= (-5.1d-164)) then
        tmp = 1.0d0
    else if (z <= 7.5d-99) then
        tmp = 1.0d0 + ((x / t) / y)
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -5.1e-164) {
		tmp = 1.0;
	} else if (z <= 7.5e-99) {
		tmp = 1.0 + ((x / t) / y);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -5.1e-164:
		tmp = 1.0
	elif z <= 7.5e-99:
		tmp = 1.0 + ((x / t) / y)
	else:
		tmp = 1.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -5.1e-164)
		tmp = 1.0;
	elseif (z <= 7.5e-99)
		tmp = Float64(1.0 + Float64(Float64(x / t) / y));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -5.1e-164)
		tmp = 1.0;
	elseif (z <= 7.5e-99)
		tmp = 1.0 + ((x / t) / y);
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.1e-164], 1.0, If[LessEqual[z, 7.5e-99], N[(1.0 + N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{-164}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.10000000000000036e-164 or 7.4999999999999999e-99 < z

    1. Initial program 99.4%

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

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

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

    if -5.10000000000000036e-164 < z < 7.4999999999999999e-99

    1. Initial program 96.2%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t \cdot y} + 1} \]
      2. *-commutative71.8%

        \[\leadsto \frac{x}{\color{blue}{y \cdot t}} + 1 \]
    6. Simplified71.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot t} + 1} \]
    7. Taylor expanded in x around 0 71.8%

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

        \[\leadsto \color{blue}{\frac{\frac{x}{t}}{y}} + 1 \]
    9. Simplified73.2%

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

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

Alternative 8: 84.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.66 \cdot 10^{-99}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-55}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.66e-99) 1.0 (if (<= y 1.8e-55) (- 1.0 (/ x (* z t))) 1.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.66e-99) {
		tmp = 1.0;
	} else if (y <= 1.8e-55) {
		tmp = 1.0 - (x / (z * t));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
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.66d-99)) then
        tmp = 1.0d0
    else if (y <= 1.8d-55) then
        tmp = 1.0d0 - (x / (z * t))
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.66e-99) {
		tmp = 1.0;
	} else if (y <= 1.8e-55) {
		tmp = 1.0 - (x / (z * t));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -1.66e-99:
		tmp = 1.0
	elif y <= 1.8e-55:
		tmp = 1.0 - (x / (z * t))
	else:
		tmp = 1.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.66e-99)
		tmp = 1.0;
	elseif (y <= 1.8e-55)
		tmp = Float64(1.0 - Float64(x / Float64(z * t)));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.66e-99)
		tmp = 1.0;
	elseif (y <= 1.8e-55)
		tmp = 1.0 - (x / (z * t));
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.66e-99], 1.0, If[LessEqual[y, 1.8e-55], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.66 \cdot 10^{-99}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.6599999999999999e-99 or 1.8e-55 < y

    1. Initial program 100.0%

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

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

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

    if -1.6599999999999999e-99 < y < 1.8e-55

    1. Initial program 96.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.66 \cdot 10^{-99}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-55}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 83.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.6 \cdot 10^{-99}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-54}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -5.6e-99) 1.0 (if (<= y 1.3e-54) (- 1.0 (/ (/ x t) z)) 1.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -5.6e-99) {
		tmp = 1.0;
	} else if (y <= 1.3e-54) {
		tmp = 1.0 - ((x / t) / z);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
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 <= (-5.6d-99)) then
        tmp = 1.0d0
    else if (y <= 1.3d-54) then
        tmp = 1.0d0 - ((x / t) / z)
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -5.6e-99) {
		tmp = 1.0;
	} else if (y <= 1.3e-54) {
		tmp = 1.0 - ((x / t) / z);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -5.6e-99:
		tmp = 1.0
	elif y <= 1.3e-54:
		tmp = 1.0 - ((x / t) / z)
	else:
		tmp = 1.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -5.6e-99)
		tmp = 1.0;
	elseif (y <= 1.3e-54)
		tmp = Float64(1.0 - Float64(Float64(x / t) / z));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -5.6e-99)
		tmp = 1.0;
	elseif (y <= 1.3e-54)
		tmp = 1.0 - ((x / t) / z);
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.6e-99], 1.0, If[LessEqual[y, 1.3e-54], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{-99}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.6000000000000001e-99 or 1.30000000000000001e-54 < y

    1. Initial program 100.0%

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

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

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

    if -5.6000000000000001e-99 < y < 1.30000000000000001e-54

    1. Initial program 96.4%

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
      2. div-inv75.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.6 \cdot 10^{-99}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-54}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 76.2% accurate, 11.0× speedup?

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

\\
1
\end{array}
Derivation
  1. Initial program 98.6%

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

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

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

    \[\leadsto 1 \]
  6. Add Preprocessing

Reproduce

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