\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\begin{array}{l}
\mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \le 0.0:\\
\;\;\;\;\frac{1}{\frac{t - z}{\frac{x}{y - z}}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{\left(y - z\right) \cdot \left(t - z\right)}\\
\end{array}double code(double x, double y, double z, double t) {
return ((double) (x / ((double) (((double) (y - z)) * ((double) (t - z))))));
}
double code(double x, double y, double z, double t) {
double VAR;
if ((((double) (x / ((double) (((double) (y - z)) * ((double) (t - z)))))) <= 0.0)) {
VAR = ((double) (1.0 / ((double) (((double) (t - z)) / ((double) (x / ((double) (y - z))))))));
} else {
VAR = ((double) (x * ((double) (1.0 / ((double) (((double) (y - z)) * ((double) (t - z))))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.3 |
|---|---|
| Target | 8.1 |
| Herbie | 1.8 |
if (/ x (* (- y z) (- t z))) < 0.0Initial program 9.1
rmApplied associate-/r*1.4
rmApplied clear-num1.9
if 0.0 < (/ x (* (- y z) (- t z))) Initial program 1.4
rmApplied div-inv1.7
Final simplification1.8
herbie shell --seed 2020148
(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))))