Average Error: 6.7 → 1.6
Time: 6.7s
Precision: binary64
\[[y, t] = \mathsf{sort}([y, t]) \\]
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
\[\begin{array}{l} t_1 := \frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{if}\;t_1 \leq -3.0511107772526236 \cdot 10^{-289}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq 4.794012462935694 \cdot 10^{-258}:\\ \;\;\;\;\frac{1}{\frac{y - z}{\frac{x}{t - z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}\\ \end{array} \]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
t_1 := \frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\
\mathbf{if}\;t_1 \leq -3.0511107772526236 \cdot 10^{-289}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_1 \leq 4.794012462935694 \cdot 10^{-258}:\\
\;\;\;\;\frac{1}{\frac{y - z}{\frac{x}{t - z}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}\\


\end{array}
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ x (* (- y z) (- t z)))))
   (if (<= t_1 -3.0511107772526236e-289)
     t_1
     (if (<= t_1 4.794012462935694e-258)
       (/ 1.0 (/ (- y z) (/ x (- t z))))
       (* (/ (* (cbrt x) (cbrt x)) (- y z)) (/ (cbrt x) (- t z)))))))
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 = x / ((y - z) * (t - z));
	double tmp;
	if (t_1 <= -3.0511107772526236e-289) {
		tmp = t_1;
	} else if (t_1 <= 4.794012462935694e-258) {
		tmp = 1.0 / ((y - z) / (x / (t - z)));
	} else {
		tmp = ((cbrt(x) * cbrt(x)) / (y - z)) * (cbrt(x) / (t - z));
	}
	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

Original6.7
Target7.4
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 3 regimes
  2. if (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) < -3.05111077725262363e-289

    1. Initial program 1.2

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

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

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
    4. Applied *-un-lft-identity_binary644.1

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

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

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

    if -3.05111077725262363e-289 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) < 4.7940124629356944e-258

    1. Initial program 11.8

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{x}{t - z}}}{y - z} \]
    6. Applied *-un-lft-identity_binary640.6

      \[\leadsto \frac{\frac{x}{\color{blue}{1 \cdot \left(t - z\right)}}}{y - z} \]
    7. Applied *-un-lft-identity_binary640.6

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot x}}{1 \cdot \left(t - z\right)}}{y - z} \]
    8. Applied times-frac_binary640.6

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

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

    if 4.7940124629356944e-258 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z)))

    1. Initial program 1.3

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

      \[\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 times-frac_binary642.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \leq -3.0511107772526236 \cdot 10^{-289}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{elif}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \leq 4.794012462935694 \cdot 10^{-258}:\\ \;\;\;\;\frac{1}{\frac{y - z}{\frac{x}{t - z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}\\ \end{array} \]

Reproduce

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