Average Error: 7.3 → 2.2
Time: 3.9s
Precision: binary64
\[ \begin{array}{c}[y, t] = \mathsf{sort}([y, t])\\ \end{array} \]
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
\[\begin{array}{l} \mathbf{if}\;t \leq 1.15 \cdot 10^{-71}:\\ \;\;\;\;\frac{\frac{-1}{\frac{y - z}{x}}}{z - t}\\ \mathbf{elif}\;t \leq 2.25 \cdot 10^{+171}:\\ \;\;\;\;\frac{\frac{x}{z - t}}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z - y}}{z - t}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
(FPCore (x y z t)
 :precision binary64
 (if (<= t 1.15e-71)
   (/ (/ -1.0 (/ (- y z) x)) (- z t))
   (if (<= t 2.25e+171) (/ (/ x (- z t)) (- z y)) (/ (/ x (- z y)) (- z t)))))
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 tmp;
	if (t <= 1.15e-71) {
		tmp = (-1.0 / ((y - z) / x)) / (z - t);
	} else if (t <= 2.25e+171) {
		tmp = (x / (z - t)) / (z - y);
	} else {
		tmp = (x / (z - y)) / (z - t);
	}
	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 = x / ((y - z) * (t - z))
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 (t <= 1.15d-71) then
        tmp = ((-1.0d0) / ((y - z) / x)) / (z - t)
    else if (t <= 2.25d+171) then
        tmp = (x / (z - t)) / (z - y)
    else
        tmp = (x / (z - y)) / (z - t)
    end if
    code = tmp
end function
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 tmp;
	if (t <= 1.15e-71) {
		tmp = (-1.0 / ((y - z) / x)) / (z - t);
	} else if (t <= 2.25e+171) {
		tmp = (x / (z - t)) / (z - y);
	} else {
		tmp = (x / (z - y)) / (z - t);
	}
	return tmp;
}
def code(x, y, z, t):
	return x / ((y - z) * (t - z))
def code(x, y, z, t):
	tmp = 0
	if t <= 1.15e-71:
		tmp = (-1.0 / ((y - z) / x)) / (z - t)
	elif t <= 2.25e+171:
		tmp = (x / (z - t)) / (z - y)
	else:
		tmp = (x / (z - y)) / (z - t)
	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)
	tmp = 0.0
	if (t <= 1.15e-71)
		tmp = Float64(Float64(-1.0 / Float64(Float64(y - z) / x)) / Float64(z - t));
	elseif (t <= 2.25e+171)
		tmp = Float64(Float64(x / Float64(z - t)) / Float64(z - y));
	else
		tmp = Float64(Float64(x / Float64(z - y)) / Float64(z - t));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = x / ((y - z) * (t - z));
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= 1.15e-71)
		tmp = (-1.0 / ((y - z) / x)) / (z - t);
	elseif (t <= 2.25e+171)
		tmp = (x / (z - t)) / (z - y);
	else
		tmp = (x / (z - y)) / (z - t);
	end
	tmp_2 = 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_] := If[LessEqual[t, 1.15e-71], N[(N[(-1.0 / N[(N[(y - z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.25e+171], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]]]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;t \leq 1.15 \cdot 10^{-71}:\\
\;\;\;\;\frac{\frac{-1}{\frac{y - z}{x}}}{z - t}\\

\mathbf{elif}\;t \leq 2.25 \cdot 10^{+171}:\\
\;\;\;\;\frac{\frac{x}{z - t}}{z - y}\\

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


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.3
Target8.2
Herbie2.2
\[\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 t < 1.1499999999999999e-71

    1. Initial program 7.5

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

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

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

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

    if 1.1499999999999999e-71 < t < 2.24999999999999984e171

    1. Initial program 5.2

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

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

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

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

    if 2.24999999999999984e171 < t

    1. Initial program 10.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.15 \cdot 10^{-71}:\\ \;\;\;\;\frac{\frac{-1}{\frac{y - z}{x}}}{z - t}\\ \mathbf{elif}\;t \leq 2.25 \cdot 10^{+171}:\\ \;\;\;\;\frac{\frac{x}{z - t}}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z - y}}{z - t}\\ \end{array} \]

Reproduce

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