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

Percentage Accurate: 99.1% → 98.5%
Time: 6.7s
Alternatives: 9
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 9 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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 98.5% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 2: 85.6% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.0000000000000003e-133 or 5.99999999999999978e-69 < y

    1. Initial program 100.0%

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

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

    if -4.0000000000000003e-133 < y < 5.99999999999999978e-69

    1. Initial program 96.5%

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

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

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

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

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

Alternative 3: 70.9% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.4200000000000001e-29 or 9.00000000000000085e-34 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{y \cdot t}\right)} - 1\right) \]
      4. sqrt-unprod65.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-neg65.5%

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

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

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

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

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

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

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

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

    if -1.4200000000000001e-29 < y < 9.00000000000000085e-34

    1. Initial program 97.3%

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

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

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

Alternative 4: 81.5% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.60000000000000001e-40 or 7.2000000000000002e-15 < 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 91.6%

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

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

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

    if -1.60000000000000001e-40 < y < 7.2000000000000002e-15

    1. Initial program 97.3%

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

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

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

Alternative 5: 81.3% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.59999999999999965e-40 or 3.4e-15 < 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 91.6%

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

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

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

    if -9.59999999999999965e-40 < y < 3.4e-15

    1. Initial program 97.3%

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

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

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

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

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

Alternative 6: 81.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

    if -1.8e-40 < y < 9.49999999999999991e-13

    1. Initial program 97.3%

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

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

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

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

    if 9.49999999999999991e-13 < 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 90.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{-40}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-13}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y \cdot y}\\ \end{array} \]

Alternative 7: 90.7% accurate, 1.0× speedup?

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

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


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

    1. Initial program 97.9%

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

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

    if 2.29999999999999991e-112 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

Alternative 8: 99.1% accurate, 1.0× speedup?

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

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

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

Alternative 9: 52.2% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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-neg53.8%

      \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{y \cdot t}\right)} - 1\right) \]
    6. sqrt-unprod28.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-sqrt54.7%

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

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

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

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

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

    \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot y}} \]
  12. Final simplification56.6%

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

Reproduce

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