\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)} \leq -2.706556547970783 \cdot 10^{-173}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\
\mathbf{elif}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \leq 8.33579817500726 \cdot 10^{-265}:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
(FPCore (x y z t)
:precision binary64
(if (<= (/ x (* (- y z) (- t z))) -2.706556547970783e-173)
(/ x (* (- y z) (- t z)))
(if (<= (/ x (* (- y z) (- t z))) 8.33579817500726e-265)
(/ (/ x (- t z)) (- y z))
(* (/ (* (cbrt x) (cbrt x)) (- y z)) (/ (cbrt x) (- t 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 tmp;
if ((x / ((y - z) * (t - z))) <= -2.706556547970783e-173) {
tmp = x / ((y - z) * (t - z));
} else if ((x / ((y - z) * (t - z))) <= 8.33579817500726e-265) {
tmp = (x / (t - z)) / (y - z);
} else {
tmp = ((cbrt(x) * cbrt(x)) / (y - z)) * (cbrt(x) / (t - 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.6 |
if (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) < -2.7065565479707829e-173Initial program 1.8
if -2.7065565479707829e-173 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) < 8.3357981750072597e-265Initial program 11.3
rmApplied add-cube-cbrt_binary64_2159611.5
Applied times-frac_binary64_215670.9
rmApplied associate-*l/_binary64_215041.5
Simplified1.1
if 8.3357981750072597e-265 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) Initial program 1.5
rmApplied add-cube-cbrt_binary64_215962.6
Applied times-frac_binary64_215672.7
Final simplification1.6
herbie shell --seed 2020342
(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))))