\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\begin{array}{l}
\mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le 5.91751804643800335 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{1}{t - z}}{\frac{y - z}{x}}\\
\mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 1.1045621638475217 \cdot 10^{279}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\
\end{array}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 VAR;
if ((((y - z) * (t - z)) <= 5.917518046438003e-107)) {
VAR = ((1.0 / (t - z)) / ((y - z) / x));
} else {
double VAR_1;
if ((((y - z) * (t - z)) <= 1.1045621638475217e+279)) {
VAR_1 = (x / ((y - z) * (t - z)));
} else {
VAR_1 = ((x / (y - z)) / (t - z));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.8 |
|---|---|
| Target | 8.4 |
| Herbie | 1.1 |
if (* (- y z) (- t z)) < 5.917518046438003e-107Initial program 7.5
rmApplied *-commutative7.5
Applied associate-/r*3.1
rmApplied clear-num3.3
rmApplied associate-/r/3.1
Applied associate-/l*2.6
if 5.917518046438003e-107 < (* (- y z) (- t z)) < 1.1045621638475217e+279Initial program 0.2
if 1.1045621638475217e+279 < (* (- y z) (- t z)) Initial program 14.9
rmApplied associate-/r*0.1
Final simplification1.1
herbie shell --seed 2020078
(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 (* (- y z) (- t z)))))
(/ x (* (- y z) (- t z))))