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) (((double) (y - z)) * ((double) (t - z)))) <= -7.60800479161067e+255)) {
VAR = ((double) (1.0 / ((double) (((double) (t - z)) * ((double) (((double) (y - z)) / x))))));
} else {
double VAR_1;
if ((((double) (((double) (y - z)) * ((double) (t - z)))) <= 2.0116549643711714e+161)) {
VAR_1 = ((double) (x / ((double) (((double) (y - z)) * ((double) (t - z))))));
} else {
VAR_1 = ((double) (((double) (x * ((double) (1.0 / ((double) (t - z)))))) / ((double) (y - 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.3 |
|---|---|
| Target | 8.4 |
| Herbie | 1.0 |
if (* (- y z) (- t z)) < -7.6080047916106696e255Initial program 15.5
rmApplied clear-num15.6
Simplified0.6
if -7.6080047916106696e255 < (* (- y z) (- t z)) < 2.01165496437117143e161Initial program 1.6
if 2.01165496437117143e161 < (* (- y z) (- t z)) Initial program 10.6
rmApplied *-un-lft-identity10.6
Applied times-frac0.6
rmApplied associate-*l/0.5
Simplified0.5
rmApplied div-inv0.6
Final simplification1.0
herbie shell --seed 2020180
(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))))