\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \le -8.3294717432622867 \cdot 10^{148} \lor \neg \left(\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \le 43365737702639354000\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(y + 1\right) - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{\left(y - z\right) + 1}}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x * ((double) (((double) (y - z)) + 1.0)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((((double) (((double) (x * ((double) (((double) (y - z)) + 1.0)))) / z)) <= -8.329471743262287e+148) || !(((double) (((double) (x * ((double) (((double) (y - z)) + 1.0)))) / z)) <= 4.336573770263935e+19))) {
VAR = ((double) (((double) (((double) (x / z)) * ((double) (y + 1.0)))) - x));
} else {
VAR = ((double) (x / ((double) (z / ((double) (((double) (y - z)) + 1.0))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.2 |
|---|---|
| Target | 0.5 |
| Herbie | 0.6 |
if (/ (* x (+ (- y z) 1.0)) z) < -8.3294717432622867e148 or 43365737702639354000 < (/ (* x (+ (- y z) 1.0)) z) Initial program 21.8
Simplified5.6
rmApplied clear-num5.6
rmApplied associate-/r/5.6
Applied associate-*r*0.2
Simplified0.1
if -8.3294717432622867e148 < (/ (* x (+ (- y z) 1.0)) z) < 43365737702639354000Initial program 0.1
rmApplied associate-/l*1.1
Final simplification0.6
herbie shell --seed 2020181
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))