\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 -1.1139773717897069 \cdot 10^{+73}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\
\mathbf{elif}\;t_1 \leq 3.615670797450081 \cdot 10^{+109}:\\
\;\;\;\;\frac{x}{\left({z}^{2} + y \cdot t\right) - \left(y \cdot z + z \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - 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 (* (- y z) (- t z))))
(if (<= t_1 -1.1139773717897069e+73)
(/ (/ x (- y z)) (- t z))
(if (<= t_1 3.615670797450081e+109)
(/ x (- (+ (pow z 2.0) (* y t)) (+ (* y z) (* z t))))
(/ (/ x (- t z)) (- y 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 = (y - z) * (t - z);
double tmp;
if (t_1 <= -1.1139773717897069e+73) {
tmp = (x / (y - z)) / (t - z);
} else if (t_1 <= 3.615670797450081e+109) {
tmp = x / ((pow(z, 2.0) + (y * t)) - ((y * z) + (z * t)));
} else {
tmp = (x / (t - z)) / (y - z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.3 |
|---|---|
| Target | 8.2 |
| Herbie | 1.3 |
if (*.f64 (-.f64 y z) (-.f64 t z)) < -1.1139773717897069e73Initial program 8.4
Applied associate-/r*_binary641.5
if -1.1139773717897069e73 < (*.f64 (-.f64 y z) (-.f64 t z)) < 3.615670797450081e109Initial program 2.4
Taylor expanded in x around inf 2.4
if 3.615670797450081e109 < (*.f64 (-.f64 y z) (-.f64 t z)) Initial program 9.7
Applied associate-/r*_binary640.5
Applied clear-num_binary641.2
Applied associate-/r/_binary641.2
Applied associate-/r*_binary640.7
Simplified0.6
Final simplification1.3
herbie shell --seed 2022097
(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))))