Average Error: 0.7 → 4.1
Time: 8.2s
Precision: binary64
Cost: 840
\[ \begin{array}{c}[z, t] = \mathsf{sort}([z, t])\\ \end{array} \]
\[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.2501548028623123 \cdot 10^{-59}:\\ \;\;\;\;1 - \frac{x}{z \cdot \left(t - y\right)}\\ \mathbf{elif}\;z \leq 10^{-230}:\\ \;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
(FPCore (x y z t)
 :precision binary64
 (if (<= z -1.2501548028623123e-59)
   (- 1.0 (/ x (* z (- t y))))
   (if (<= z 1e-230) (- 1.0 (/ (/ x (- y t)) y)) (- 1.0 (/ x (* t (- z y)))))))
double code(double x, double y, double z, double t) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.2501548028623123e-59) {
		tmp = 1.0 - (x / (z * (t - y)));
	} else if (z <= 1e-230) {
		tmp = 1.0 - ((x / (y - t)) / 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
    code = 1.0d0 - (x / ((y - z) * (y - t)))
end 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.2501548028623123d-59)) then
        tmp = 1.0d0 - (x / (z * (t - y)))
    else if (z <= 1d-230) then
        tmp = 1.0d0 - ((x / (y - t)) / 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) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.2501548028623123e-59) {
		tmp = 1.0 - (x / (z * (t - y)));
	} else if (z <= 1e-230) {
		tmp = 1.0 - ((x / (y - t)) / y);
	} else {
		tmp = 1.0 - (x / (t * (z - y)));
	}
	return tmp;
}
def code(x, y, z, t):
	return 1.0 - (x / ((y - z) * (y - t)))
def code(x, y, z, t):
	tmp = 0
	if z <= -1.2501548028623123e-59:
		tmp = 1.0 - (x / (z * (t - y)))
	elif z <= 1e-230:
		tmp = 1.0 - ((x / (y - t)) / y)
	else:
		tmp = 1.0 - (x / (t * (z - y)))
	return tmp
function code(x, y, z, t)
	return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t))))
end
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -1.2501548028623123e-59)
		tmp = Float64(1.0 - Float64(x / Float64(z * Float64(t - y))));
	elseif (z <= 1e-230)
		tmp = Float64(1.0 - Float64(Float64(x / Float64(y - t)) / y));
	else
		tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y))));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = 1.0 - (x / ((y - z) * (y - t)));
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -1.2501548028623123e-59)
		tmp = 1.0 - (x / (z * (t - y)));
	elseif (z <= 1e-230)
		tmp = 1.0 - ((x / (y - t)) / y);
	else
		tmp = 1.0 - (x / (t * (z - y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2501548028623123e-59], N[(1.0 - N[(x / N[(z * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e-230], N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\begin{array}{l}
\mathbf{if}\;z \leq -1.2501548028623123 \cdot 10^{-59}:\\
\;\;\;\;1 - \frac{x}{z \cdot \left(t - y\right)}\\

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

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if z < -1.25015480286231229e-59

    1. Initial program 0.0

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

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

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

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

    if -1.25015480286231229e-59 < z < 1.00000000000000005e-230

    1. Initial program 2.1

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Applied egg-rr0.6

      \[\leadsto 1 - \color{blue}{\frac{{\left(\sqrt[3]{x}\right)}^{2}}{y - t} \cdot \frac{\sqrt[3]{x}}{y - z}} \]
    3. Taylor expanded in z around 0 8.1

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

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

    if 1.00000000000000005e-230 < z

    1. Initial program 0.3

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

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

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

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

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

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

Alternatives

Alternative 1
Error8.7
Cost840
\[\begin{array}{l} t_1 := 1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{if}\;y \leq -1 \cdot 10^{-91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.5319920759644116 \cdot 10^{-61}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error6.6
Cost840
\[\begin{array}{l} t_1 := 1 - \frac{x}{y \cdot \left(y - z\right)}\\ \mathbf{if}\;y \leq -1 \cdot 10^{-91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.5319920759644116 \cdot 10^{-61}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error6.8
Cost840
\[\begin{array}{l} t_1 := 1 - \frac{\frac{x}{y - t}}{y}\\ \mathbf{if}\;y \leq -1.148049451252067 \cdot 10^{-46}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.344594453818762 \cdot 10^{-51}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error4.0
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -4.568444477726022 \cdot 10^{-46}:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\ \mathbf{elif}\;z \leq 10^{-230}:\\ \;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \end{array} \]
Alternative 5
Error11.6
Cost712
\[\begin{array}{l} t_1 := 1 - \frac{x}{y \cdot y}\\ \mathbf{if}\;y \leq -0.02743334709335699:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7629111348.573532:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error11.6
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -0.02743334709335699:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{elif}\;y \leq 7629111348.573532:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y \cdot y}\\ \end{array} \]
Alternative 7
Error11.7
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -0.02743334709335699:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{elif}\;y \leq 7629111348.573532:\\ \;\;\;\;1 - \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y \cdot y}\\ \end{array} \]
Alternative 8
Error25.6
Cost448
\[1 - \frac{\frac{x}{t}}{z} \]

Error

Reproduce

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