\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)\\
t_2 := \frac{\frac{x}{y - z}}{t - z}\\
\mathbf{if}\;t_1 \leq -1.0594107857469512 \cdot 10^{+298}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 1.0247681833563597 \cdot 10^{+222}:\\
\;\;\;\;\frac{x}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\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))) (t_2 (/ (/ x (- y z)) (- t z))))
(if (<= t_1 -1.0594107857469512e+298)
t_2
(if (<= t_1 1.0247681833563597e+222) (/ x t_1) t_2))))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 t_2 = (x / (y - z)) / (t - z);
double tmp;
if (t_1 <= -1.0594107857469512e+298) {
tmp = t_2;
} else if (t_1 <= 1.0247681833563597e+222) {
tmp = x / t_1;
} else {
tmp = t_2;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.9 |
|---|---|
| Target | 7.6 |
| Herbie | 0.7 |
if (*.f64 (-.f64 y z) (-.f64 t z)) < -1.0594107857469512e298 or 1.0247681833563597e222 < (*.f64 (-.f64 y z) (-.f64 t z)) Initial program 12.9
Applied associate-/r*_binary640.1
if -1.0594107857469512e298 < (*.f64 (-.f64 y z) (-.f64 t z)) < 1.0247681833563597e222Initial program 1.3
Applied pow1_binary641.3
Final simplification0.7
herbie shell --seed 2022125
(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))))