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 ((z <= -4.715925227576331e-242)) {
VAR = ((double) (((double) (x / ((double) (y - z)))) / ((double) (t - z))));
} else {
double VAR_1;
if ((z <= 8.900490363783676e-162)) {
VAR_1 = ((double) (x / ((double) (((double) (((double) (y - z)) * t)) + ((double) (z * ((double) (z - y))))))));
} else {
VAR_1 = ((double) (((double) (1.0 / ((double) (y - z)))) * ((double) (x * ((double) (1.0 / ((double) (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.6 |
|---|---|
| Target | 8.4 |
| Herbie | 2.2 |
if z < -4.7159252275763314e-242Initial program 7.4
rmApplied associate-/r*1.5
if -4.7159252275763314e-242 < z < 8.90049036378367575e-162Initial program 6.5
rmApplied sub-neg6.5
Applied distribute-lft-in6.5
Simplified6.5
if 8.90049036378367575e-162 < z Initial program 8.2
rmApplied *-un-lft-identity8.2
Applied times-frac1.1
rmApplied div-inv1.2
Final simplification2.2
herbie shell --seed 2020192
(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))))