Average Error: 7.4 → 1.1
Time: 4.6s
Precision: binary64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
\[\begin{array}{l} t_1 := \left(y - z\right) \cdot \left(t - z\right)\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{+201}:\\ \;\;\;\;\frac{\frac{x}{z - t}}{z - y}\\ \mathbf{elif}\;t_1 \leq -2 \cdot 10^{-248}:\\ \;\;\;\;\frac{x}{\left(z - t\right) \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\sqrt[3]{x}\right)}^{2}}{z - t} \cdot \frac{\sqrt[3]{x}}{z - y}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (- y z) (- t z))))
   (if (<= t_1 -2e+201)
     (/ (/ x (- z t)) (- z y))
     (if (<= t_1 -2e-248)
       (/ x (* (- z t) (- z y)))
       (* (/ (pow (cbrt x) 2.0) (- z t)) (/ (cbrt x) (- z y)))))))
double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * (t - z);
	double tmp;
	if (t_1 <= -2e+201) {
		tmp = (x / (z - t)) / (z - y);
	} else if (t_1 <= -2e-248) {
		tmp = x / ((z - t) * (z - y));
	} else {
		tmp = (pow(cbrt(x), 2.0) / (z - t)) * (cbrt(x) / (z - y));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * (t - z);
	double tmp;
	if (t_1 <= -2e+201) {
		tmp = (x / (z - t)) / (z - y);
	} else if (t_1 <= -2e-248) {
		tmp = x / ((z - t) * (z - y));
	} else {
		tmp = (Math.pow(Math.cbrt(x), 2.0) / (z - t)) * (Math.cbrt(x) / (z - y));
	}
	return tmp;
}
function code(x, y, z, t)
	return Float64(x / Float64(Float64(y - z) * Float64(t - z)))
end
function code(x, y, z, t)
	t_1 = Float64(Float64(y - z) * Float64(t - z))
	tmp = 0.0
	if (t_1 <= -2e+201)
		tmp = Float64(Float64(x / Float64(z - t)) / Float64(z - y));
	elseif (t_1 <= -2e-248)
		tmp = Float64(x / Float64(Float64(z - t) * Float64(z - y)));
	else
		tmp = Float64(Float64((cbrt(x) ^ 2.0) / Float64(z - t)) * Float64(cbrt(x) / Float64(z - y)));
	end
	return tmp
end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+201], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2e-248], N[(x / N[(N[(z - t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+201}:\\
\;\;\;\;\frac{\frac{x}{z - t}}{z - y}\\

\mathbf{elif}\;t_1 \leq -2 \cdot 10^{-248}:\\
\;\;\;\;\frac{x}{\left(z - t\right) \cdot \left(z - y\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(\sqrt[3]{x}\right)}^{2}}{z - t} \cdot \frac{\sqrt[3]{x}}{z - y}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.4
Target8.2
Herbie1.1
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} < 0:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array} \]

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 (-.f64 y z) (-.f64 t z)) < -2.00000000000000008e201

    1. Initial program 12.2

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Simplified0.5

      \[\leadsto \color{blue}{\frac{\frac{x}{z - y}}{z - t}} \]
    3. Applied egg-rr0.6

      \[\leadsto \color{blue}{\frac{{\left(\sqrt[3]{x}\right)}^{2}}{z - t} \cdot \frac{\sqrt[3]{x}}{z - y}} \]
    4. Applied egg-rr0.4

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

    if -2.00000000000000008e201 < (*.f64 (-.f64 y z) (-.f64 t z)) < -1.99999999999999996e-248

    1. Initial program 0.2

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Simplified5.8

      \[\leadsto \color{blue}{\frac{\frac{x}{z - y}}{z - t}} \]
    3. Taylor expanded in x around 0 0.2

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

    if -1.99999999999999996e-248 < (*.f64 (-.f64 y z) (-.f64 t z))

    1. Initial program 8.0

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Simplified1.7

      \[\leadsto \color{blue}{\frac{\frac{x}{z - y}}{z - t}} \]
    3. Applied egg-rr1.5

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

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

Reproduce

herbie shell --seed 2022210 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
  :precision binary64

  :herbie-target
  (if (< (/ x (* (- y z) (- t z))) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 (* (- y z) (- t z)))))

  (/ x (* (- y z) (- t z))))