Average Error: 7.5 → 1.6
Time: 5.2s
Precision: binary64
\[[y, t] = \mathsf{sort}([y, t]) \\]
\[\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)\\ t_2 := \frac{\frac{x}{t - z}}{y - z}\\ \mathbf{if}\;t_1 \leq -5.30931023714603 \cdot 10^{+93}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 11.036884943702017:\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{y - z}{\frac{\sqrt[3]{x}}{t - z}}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
\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)\\
t_2 := \frac{\frac{x}{t - z}}{y - z}\\
\mathbf{if}\;t_1 \leq -5.30931023714603 \cdot 10^{+93}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_1 \leq 11.036884943702017:\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{y - z}{\frac{\sqrt[3]{x}}{t - z}}}\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\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))) (t_2 (/ (/ x (- t z)) (- y z))))
   (if (<= t_1 -5.30931023714603e+93)
     t_2
     (if (<= t_1 11.036884943702017)
       (/ (* (cbrt x) (cbrt x)) (/ (- y z) (/ (cbrt x) (- t z))))
       t_2))))
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 t_2 = (x / (t - z)) / (y - z);
	double tmp;
	if (t_1 <= -5.30931023714603e+93) {
		tmp = t_2;
	} else if (t_1 <= 11.036884943702017) {
		tmp = (cbrt(x) * cbrt(x)) / ((y - z) / (cbrt(x) / (t - z)));
	} else {
		tmp = t_2;
	}
	return tmp;
}

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.5
Target8.1
Herbie1.6
\[\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 2 regimes
  2. if (*.f64 (-.f64 y z) (-.f64 t z)) < -5.30931023714603034e93 or 11.036884943702017 < (*.f64 (-.f64 y z) (-.f64 t z))

    1. Initial program 8.6

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Applied *-un-lft-identity_binary648.6

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{\left(y - z\right) \cdot \left(t - z\right)} \]
    3. Applied times-frac_binary641.2

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
    4. Applied associate-*l/_binary641.2

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{t - z}}{y - z}} \]
    5. Simplified1.2

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

    if -5.30931023714603034e93 < (*.f64 (-.f64 y z) (-.f64 t z)) < 11.036884943702017

    1. Initial program 3.3

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Applied add-cube-cbrt_binary644.4

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(y - z\right) \cdot \left(t - z\right)} \]
    3. Applied associate-/l*_binary644.4

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\left(y - z\right) \cdot \left(t - z\right)}{\sqrt[3]{x}}}} \]
    4. Simplified3.0

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

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

Reproduce

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