Average Error: 7.3 → 1.0
Time: 6.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)\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2.5677992260524592 \cdot 10^{+68}\right):\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t_1}\\ \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)\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2.5677992260524592 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{t_1}\\


\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 (or (<= t_1 (- INFINITY)) (not (<= t_1 2.5677992260524592e+68)))
     (/ (/ x (- t z)) (- y z))
     (/ x t_1))))
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 <= -((double) INFINITY)) || !(t_1 <= 2.5677992260524592e+68)) {
		tmp = (x / (t - z)) / (y - z);
	} else {
		tmp = x / t_1;
	}
	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.3
Target7.9
Herbie1.0
\[\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)) < -inf.0 or 2.56779922605245925e68 < (*.f64 (-.f64 y z) (-.f64 t z))

    1. Initial program 11.0

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

      \[\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} \]

    if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) < 2.56779922605245925e68

    1. Initial program 1.7

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \leq -\infty \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \leq 2.5677992260524592 \cdot 10^{+68}\right):\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array} \]

Reproduce

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